CKFinder 3 – PHP Connector Documentation
ExistingFile Class Reference
Inheritance diagram for ExistingFile:
File CopiedFile DeletedFile DownloadedFile EditedFile RenamedFile MovedFile EditedImage

Public Member Functions

 __construct ($fileName, $folder, ResourceType $resourceType, CKFinder $app)
 
 getPath ()
 
 getFilePath ()
 
 hasValidPath ()
 
 getResourceType ()
 
 hasAllowedExtension ()
 
 isHidden ()
 
 hasHiddenPath ()
 
 exists ()
 
 getContentsStream ()
 
 getContents ()
 
 save ($contents, $filePath=null)
 
 addError (int $number)
 
 getErrors ()
 
 deleteThumbnails ()
 
 deleteResizedImages ()
 
 getTimestamp ()
 
 getMimeType ()
 
 getSize ()
 
- Public Member Functions inherited from File
 __construct ($fileName, CKFinder $app)
 
 hasValidFilename ()
 
 getFilename ()
 
 getExtension ()
 
 getExtensions ($newFileName=null)
 
 autorename (Backend $backend=null, $path='')
 
 isImage ()
 
 getCache ()
 

Protected Attributes

 $resourceType
 
 $folder
 
 $errors = []
 
 $metadata
 
 $backend
 
- Protected Attributes inherited from File
 $fileName
 
 $config
 
 $app
 

Additional Inherited Members

- Static Public Member Functions inherited from File
static isValidName ($fileName, $disallowUnsafeCharacters=true)
 
static secureName ($fileName, $disallowUnsafeCharacters=true, $forceAscii=false)
 
static convertToAscii ($str)
 
- Public Attributes inherited from File
const NO_EXTENSION = 'NO_EXT'
 

Detailed Description

The ExistingFile class.

Represents a file that already exists in CKFinder and can be pointed using the resource type, path and file name.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $fileName,
  $folder,
ResourceType  $resourceType,
CKFinder  $app 
)

Constructor.

Parameters
string$fileName
string$folder

Reimplemented in CopiedFile, and MovedFile.

Member Function Documentation

◆ addError()

addError ( int  $number)

Adds an error to the array of errors of the current file.

Parameters
int$numbererror number
See also
Error

◆ deleteResizedImages()

deleteResizedImages ( )

Removes resized images generated for the current file.

Returns
bool true if resized images were found and deleted

◆ deleteThumbnails()

deleteThumbnails ( )

Removes the thumbnail generated for the current file.

Returns
bool true if the thumbnail was found and deleted
Exceptions
FilesystemException

◆ exists()

exists ( )

Checks if the current file exists.

Returns
bool true if the file exists
Exceptions
FilesystemException

Reimplemented in DownloadedFile.

◆ getContents()

getContents ( )

Returns file contents.

Returns
string contents stream
Exceptions
FilesystemException

◆ getContentsStream()

getContentsStream ( )

Returns file contents stream.

Returns
resource contents stream

◆ getErrors()

getErrors ( )

Returns an array of errors that occurred during file processing.

◆ getFilePath()

getFilePath ( )

Returns backend-relative file path.

Returns
string file path

◆ getMimeType()

getMimeType ( )

Returns file MIME type.

Returns
string file MIME type
Exceptions
FilesystemException

◆ getPath()

getPath ( )

Returns backend-relative folder path (i.e. a path with a prepended resource type directory).

Returns
string backend-relative path

◆ getResourceType()

getResourceType ( )

Returns the resource type of the file.

◆ getSize()

getSize ( )

Returns file size.

Returns
int size in bytes
Exceptions
FilesystemException

◆ getTimestamp()

getTimestamp ( )

Returns last modification time.

Returns
int Unix timestamp
Exceptions
FilesystemException

◆ hasAllowedExtension()

hasAllowedExtension ( )

Checks if the current file has an extension allowed in its resource type.

Returns
bool true if the file has an allowed exception

Reimplemented in CopiedFile, and DownloadedFile.

◆ hasHiddenPath()

hasHiddenPath ( )

Checks if the current file has a hidden path (i.e. if any of the parent folders is hidden).

Returns
bool true if the path is hidden

◆ hasValidPath()

hasValidPath ( )

Checks if the current file folder path is valid.

Returns
bool true if the path is valid

◆ isHidden()

isHidden ( )

Checks if the current file is hidden.

Returns
bool true if the file is hidden

Reimplemented in DownloadedFile.

◆ save()

save (   $contents,
  $filePath = null 
)

Sets new file contents.

Parameters
string$contentsfile contents
string$filePathpath to save the file
Returns
bool true if saved successfully
Exceptions

Exception if content size is too big

Reimplemented in EditedFile.


The documentation for this class was generated from the following file: