TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Core\Resource\FileReference Class Reference
Inheritance diagram for TYPO3\CMS\Core\Resource\FileReference:
TYPO3\CMS\Core\Resource\FileInterface TYPO3\CMS\Core\Resource\ResourceInterface

Public Member Functions

 hasProperty ($key)
 
 getProperty ($key)
 
 getReferenceProperty ($key)
 
 getProperties ()
 
 getReferenceProperties ()
 
 getName ()
 
 getTitle ()
 
 getAlternative ()
 
 getDescription ()
 
 getLink ()
 
 getUid ()
 
 getSize ()
 
 getSha1 ()
 
 getExtension ()
 
 getNameWithoutExtension ()
 
 getMimeType ()
 
 getModificationTime ()
 
 getCreationTime ()
 
 getType ()
 
 isMissing ()
 
 getContents ()
 
 setContents ($contents)
 
 getStorage ()
 
 getIdentifier ()
 
 getCombinedIdentifier ()
 
 delete ()
 
 rename ($newName)
 
 getPublicUrl ($relativeToCurrentScript=FALSE)
 
 isIndexed ()
 
 getForLocalProcessing ($writable=TRUE)
 
 toArray ()
 
 getOriginalFile ()
 
 getHashedIdentifier ()
 
 getParentFolder ()
 

Protected Member Functions

 restoreNonNullValuesCallback (&$value, $key)
 

Protected Attributes

 $propertiesOfFileReference
 
 $uidOfFileReference
 
 $name
 
 $originalFile
 
 $mergedProperties = array()
 

Detailed Description

This file is part of the TYPO3 CMS project.

It is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, either version 2 of the License, or any later version.

For the full copyright and license information, please read the LICENSE.txt file that was distributed with this source code.

The TYPO3 project - inspiring people to share! Representation of a specific usage of a file with possibilities to override certain properties of the original file just for this usage of the file.

It acts as a decorator over the original file in the way that most method calls are directly passed along to the original file object.

All file related methods are directly passed along; only meta data functionality is adopted in this decorator class to priorities possible overrides for the metadata for this specific usage of the file.

Author
Ingmar Schlecht ingma.nosp@m.r@ty.nosp@m.po3.o.nosp@m.rg

Definition at line 29 of file FileReference.php.

Member Function Documentation

◆ delete()

TYPO3\CMS\Core\Resource\FileReference::delete ( )

Deletes only this particular FileReference from the persistence layer (database table sys_file_reference) but leaves the original file untouched.

Exceptions

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 384 of file FileReference.php.

◆ getAlternative()

TYPO3\CMS\Core\Resource\FileReference::getAlternative ( )

Returns the alternative text to this image

TODO: Possibly move this to the image domain object instead

Returns
string

Definition at line 209 of file FileReference.php.

References TYPO3\CMS\Core\Resource\FileReference\getProperty().

◆ getCombinedIdentifier()

TYPO3\CMS\Core\Resource\FileReference::getCombinedIdentifier ( )

Returns a combined identifier of the underlying original file

Returns
string Combined storage and file identifier, e.g. StorageUID:path/and/fileName.png

Definition at line 373 of file FileReference.php.

◆ getContents()

TYPO3\CMS\Core\Resource\FileReference::getContents ( )

Get the contents of this file

Returns
string File contents

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 333 of file FileReference.php.

◆ getCreationTime()

TYPO3\CMS\Core\Resource\FileReference::getCreationTime ( )

Returns the creation time of the file as Unix timestamp

Returns
integer

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 303 of file FileReference.php.

◆ getDescription()

TYPO3\CMS\Core\Resource\FileReference::getDescription ( )

Returns the description text to this file

TODO: Possibly move this to the image domain object instead

Returns
string

Definition at line 220 of file FileReference.php.

References TYPO3\CMS\Core\Resource\FileReference\getProperty().

◆ getExtension()

TYPO3\CMS\Core\Resource\FileReference::getExtension ( )

Get the file extension of this file

Returns
string The file extension

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 267 of file FileReference.php.

◆ getForLocalProcessing()

TYPO3\CMS\Core\Resource\FileReference::getForLocalProcessing (   $writable = TRUE)

Returns a path to a local version of this file to process it locally (e.g. with some system tool). If the file is normally located on a remote storages, this creates a local copy. If the file is already on the local system, this only makes a new copy if $writable is set to TRUE.

Parameters
boolean$writableSet this to FALSE if you only want to do read operations on the file.
Returns
string

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 442 of file FileReference.php.

◆ getHashedIdentifier()

TYPO3\CMS\Core\Resource\FileReference::getHashedIdentifier ( )

◆ getIdentifier()

TYPO3\CMS\Core\Resource\FileReference::getIdentifier ( )

Returns the identifier of the underlying original file

Returns
string

Implements TYPO3\CMS\Core\Resource\ResourceInterface.

Definition at line 364 of file FileReference.php.

Referenced by TYPO3\CMS\Core\Resource\FileReference\getHashedIdentifier().

◆ getLink()

TYPO3\CMS\Core\Resource\FileReference::getLink ( )

Returns the link that should be active when clicking on this image

TODO: Move this to the image domain object instead

Returns
string

Definition at line 231 of file FileReference.php.

◆ getMimeType()

TYPO3\CMS\Core\Resource\FileReference::getMimeType ( )

Get the MIME type of this file

Returns
array file information

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 285 of file FileReference.php.

◆ getModificationTime()

TYPO3\CMS\Core\Resource\FileReference::getModificationTime ( )

Returns the modification time of the file as Unix timestamp

Returns
integer

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 294 of file FileReference.php.

◆ getName()

TYPO3\CMS\Core\Resource\FileReference::getName ( )

Returns the name of this file

Returns
string

Implements TYPO3\CMS\Core\Resource\ResourceInterface.

Definition at line 187 of file FileReference.php.

◆ getNameWithoutExtension()

TYPO3\CMS\Core\Resource\FileReference::getNameWithoutExtension ( )

Returns the basename (the name without extension) of this file.

Returns
string

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 276 of file FileReference.php.

◆ getOriginalFile()

TYPO3\CMS\Core\Resource\FileReference::getOriginalFile ( )

Gets the original file being referenced.

Returns
File

Definition at line 462 of file FileReference.php.

References TYPO3\CMS\Core\Resource\FileReference\$originalFile.

◆ getParentFolder()

TYPO3\CMS\Core\Resource\FileReference::getParentFolder ( )

Returns the parent folder.

Returns
FolderInterface

Implements TYPO3\CMS\Core\Resource\ResourceInterface.

Definition at line 480 of file FileReference.php.

◆ getProperties()

◆ getProperty()

TYPO3\CMS\Core\Resource\FileReference::getProperty (   $key)

Gets a property, falling back to values of the parent.

Parameters
string$keyThe property to be looked up
Returns
mixed
Exceptions

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 118 of file FileReference.php.

References TYPO3\CMS\Core\Resource\FileReference\getProperties(), and TYPO3\CMS\Core\Resource\FileReference\hasProperty().

Referenced by TYPO3\CMS\Core\Resource\FileReference\getAlternative(), TYPO3\CMS\Core\Resource\FileReference\getDescription(), and TYPO3\CMS\Core\Resource\FileReference\getTitle().

◆ getPublicUrl()

TYPO3\CMS\Core\Resource\FileReference::getPublicUrl (   $relativeToCurrentScript = FALSE)

Returns a publicly accessible URL for this file

WARNING: Access to the file may be restricted by further means, e.g. some web-based authentication. You have to take care of this yourself.

Parameters
bool$relativeToCurrentScriptDetermines whether the URL returned should be relative to the current script, in case it is relative at all (only for the LocalDriver)
Returns
string

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 418 of file FileReference.php.

◆ getReferenceProperties()

TYPO3\CMS\Core\Resource\FileReference::getReferenceProperties ( )

Gets all properties of the file reference.

Returns
array

Definition at line 178 of file FileReference.php.

References TYPO3\CMS\Core\Resource\FileReference\$propertiesOfFileReference.

◆ getReferenceProperty()

TYPO3\CMS\Core\Resource\FileReference::getReferenceProperty (   $key)

Gets a property of the file reference.

Parameters
string$keyThe property to be looked up
Returns
mixed
Exceptions

Definition at line 133 of file FileReference.php.

◆ getSha1()

TYPO3\CMS\Core\Resource\FileReference::getSha1 ( )

Returns the Sha1 of this file

Returns
string

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 258 of file FileReference.php.

◆ getSize()

TYPO3\CMS\Core\Resource\FileReference::getSize ( )

Returns the size of this file

Returns
integer

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 249 of file FileReference.php.

◆ getStorage()

TYPO3\CMS\Core\Resource\FileReference::getStorage ( )

Get the storage the original file is located in

Returns
ResourceStorage

Implements TYPO3\CMS\Core\Resource\ResourceInterface.

Definition at line 355 of file FileReference.php.

Referenced by TYPO3\CMS\Core\Resource\FileReference\getHashedIdentifier().

◆ getTitle()

TYPO3\CMS\Core\Resource\FileReference::getTitle ( )

Returns the title text to this image

TODO: Possibly move this to the image domain object instead

Returns
string

Definition at line 198 of file FileReference.php.

References TYPO3\CMS\Core\Resource\FileReference\getProperty().

◆ getType()

TYPO3\CMS\Core\Resource\FileReference::getType ( )

Returns the fileType of this file

Returns
integer $fileType

Definition at line 312 of file FileReference.php.

◆ getUid()

TYPO3\CMS\Core\Resource\FileReference::getUid ( )

Returns the uid of this File In Use

Returns
integer

Definition at line 240 of file FileReference.php.

◆ hasProperty()

TYPO3\CMS\Core\Resource\FileReference::hasProperty (   $key)

Returns true if the given key exists for this file.

Parameters
string$keyThe property to be looked up
Returns
boolean

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 107 of file FileReference.php.

References TYPO3\CMS\Core\Resource\FileReference\getProperties().

Referenced by TYPO3\CMS\Core\Resource\FileReference\getProperty().

◆ isIndexed()

TYPO3\CMS\Core\Resource\FileReference::isIndexed ( )

Returns TRUE if this file is indexed. This is always true for FileReference objects, as they rely on a sys_file_reference record to be present, which in turn can only exist if the original file is indexed.

Returns
boolean

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 430 of file FileReference.php.

◆ isMissing()

TYPO3\CMS\Core\Resource\FileReference::isMissing ( )

Check if file is marked as missing by indexer

Returns
boolean

Definition at line 321 of file FileReference.php.

◆ rename()

TYPO3\CMS\Core\Resource\FileReference::rename (   $newName)

Renames the fileName in this particular usage.

Parameters
string$newNameThe new name
Exceptions

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 399 of file FileReference.php.

◆ restoreNonNullValuesCallback()

TYPO3\CMS\Core\Resource\FileReference::restoreNonNullValuesCallback ( $value,
  $key 
)
protected

Callback to handle the NULL value feature

Parameters
mixed$value
mixed$key

Definition at line 167 of file FileReference.php.

◆ setContents()

TYPO3\CMS\Core\Resource\FileReference::setContents (   $contents)

Replace the current file contents with the given string

Parameters
string$contentsThe contents to write to the file.
Returns
File The file object (allows chaining).

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 343 of file FileReference.php.

◆ toArray()

TYPO3\CMS\Core\Resource\FileReference::toArray ( )

Returns an array representation of the file. (This is used by the generic listing module vidi when displaying file records.)

Returns
array Array of main data of the file. Don't rely on all data to be present here, it's just a selection of the most relevant information.

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 452 of file FileReference.php.

References TYPO3\CMS\Core\Resource\FileReference\$propertiesOfFileReference.

Member Data Documentation

◆ $mergedProperties

TYPO3\CMS\Core\Resource\FileReference::$mergedProperties = array()
protected

◆ $name

TYPO3\CMS\Core\Resource\FileReference::$name
protected

Definition at line 54 of file FileReference.php.

◆ $originalFile

TYPO3\CMS\Core\Resource\FileReference::$originalFile
protected

◆ $propertiesOfFileReference

TYPO3\CMS\Core\Resource\FileReference::$propertiesOfFileReference
protected

◆ $uidOfFileReference

TYPO3\CMS\Core\Resource\FileReference::$uidOfFileReference
protected

Definition at line 46 of file FileReference.php.