SproutCMS

This is the code documentation for the SproutCMS project

Page options:

Inherited members

class FilesBackend

Abstract class for a backend storage for the database-managed files

Functions

NameVisibilityDescription
absUrlpublicReturns the public URL for a given file, including domain.
cleanupLocalCopypublicRemove a local copy of a file
createLocalCopypublicCreate a copy of the file in a temporary directory.
deletepublicDelete a file
existspublicReturns TRUE if the file exists, and FALSE if it does not
getStringpublicReturns file content as a string. Basically the same as file_get_contents
globpublicReturns all files which match the specified mask.
imageSizepublicReturns the size of an image, or false on failure.
moveUploadpublicMoves an uploaded file into the repository.
mtimepublicReturns the modified time, in unix timestamp format, of the specified file
putExistingpublicSaves file content from an existing file
putStreampublicSaves file content from a stream. Basically just fopen/stream_copy_to_stream/fclose
putStringpublicSaves file content as a string. Basically the same as file_put_contents
readfilepublicThis is the equivalent of the php readfile function
relUrlpublicReturns the relative public URL for a given file.
resizeUrlpublicReturns the URL for a resized image. Does not include domain.
sizepublicReturns the size, in bytes, of the specified file
touchpublicSets access and modification time of file

public absUrl

void $FilesBackend->absUrl ( mixed $filename );

Returns the public URL for a given file, including domain.

public cleanupLocalCopy

void $FilesBackend->cleanupLocalCopy ( string $temp_filename );

Remove a local copy of a file

public createLocalCopy

string $FilesBackend->createLocalCopy ( string $filename );

Create a copy of the file in a temporary directory.
Don't forget to File::destroy_local_copy($temp_filename) when you're done!

public delete

void $FilesBackend->delete ( mixed $filename );

Delete a file

public exists

void $FilesBackend->exists ( mixed $filename );

Returns TRUE if the file exists, and FALSE if it does not

public getString

void $FilesBackend->getString ( mixed $filename );

Returns file content as a string. Basically the same as file_get_contents

public glob

void $FilesBackend->glob ( mixed $mask );

Returns all files which match the specified mask.
I have a feeling this returns other sizes (e.g. .small) as well - which may not be ideal.

public imageSize

void $FilesBackend->imageSize ( mixed $filename );

Returns the size of an image, or false on failure.

Output format is the same as getimagesize, but will be at a minimum:
  [0] => width, [1] => height, [2] => type

public moveUpload

void $FilesBackend->moveUpload ( mixed $src , mixed $filename );

Moves an uploaded file into the repository.
Returns TRUE on success, FALSE on failure.

public mtime

void $FilesBackend->mtime ( mixed $filename );

Returns the modified time, in unix timestamp format, of the specified file

public putExisting

void $FilesBackend->putExisting ( mixed $filename , mixed $existing );

Saves file content from an existing file

public putStream

void $FilesBackend->putStream ( mixed $filename , mixed $stream );

Saves file content from a stream. Basically just fopen/stream_copy_to_stream/fclose

public putString

void $FilesBackend->putString ( mixed $filename , mixed $content );

Saves file content as a string. Basically the same as file_put_contents

public readfile

void $FilesBackend->readfile ( mixed $filename );

This is the equivalent of the php readfile function

public relUrl

void $FilesBackend->relUrl ( mixed $filename );

Returns the relative public URL for a given file.
Doesn't contain ROOT/ or domain. Use for content areas.

public resizeUrl

void $FilesBackend->resizeUrl ( mixed $filename , mixed $size );

Returns the URL for a resized image. Does not include domain.
Size should be 'rWIDTHxHEIGHT' or 'cWIDTHxHEIGHT'.

public size

void $FilesBackend->size ( mixed $filename );

Returns the size, in bytes, of the specified file

public touch

void $FilesBackend->touch ( mixed $filename );

Sets access and modification time of file