|
Open Journal Systems
3.3.0
|
Public Member Functions | |
| __construct () | |
| compressFile ($filePath) | |
| copyDir ($source, $dest) | |
| copyFile ($source, $dest) | |
| decompressFile ($filePath) | |
| deleteByPath ($filePath) | |
| downloadByPath ($filePath, $mediaType=null, $inline=false, $fileName=null) | |
| fileExists ($filePath, $type='file') | |
| getDocumentExtension ($type) | |
| getDocumentType ($type) | |
| getExtension ($fileName) | |
| getFirstUploadedPostName () | |
| getImageExtension ($type) | |
| getNiceFileSize ($size) | |
| getUploadedFileName ($fileName) | |
| getUploadedFilePath ($fileName) | |
| getUploadedFileType ($fileName) | |
| getUploadErrorCode ($fileName) | |
| mkdir ($dirPath, $perms=null) | |
| mkdirtree ($dirPath, $perms=null) | |
| parseFileExtension ($fileName) | |
| readFileFromPath ($filePath, $output=false) | |
| rmdir ($dirPath) | |
| rmtree ($file) | |
| setMode ($path, $mask) | |
| truncateFileName ($fileName, $length=127) | |
| uploadedFileExists ($fileName) | |
| uploadError ($fileName) | |
| uploadFile ($fileName, $destFileName) | |
| writeFile ($dest, &$contents) | |
Class defining basic operations for file management.
Definition at line 35 of file FileManager.inc.php.
| FileManager::__construct | ( | ) |
Constructor
Reimplemented in PrivateFileManager, and TemporaryFileManager.
Definition at line 39 of file FileManager.inc.php.
| FileManager::compressFile | ( | $filePath | ) |
Compress passed file.
| $filePath | string The file to be compressed. |
Definition at line 581 of file FileManager.inc.php.
| FileManager::copyDir | ( | $source, | |
| $dest | |||
| ) |
Copy a directory. Adapted from code by gimmicklessgpt at gmail dot com, at http://php.net/manual/en/function.copy.php
| $source | string the path to the source directory |
| $dest | string the path where the directory is to be saved |
Definition at line 192 of file FileManager.inc.php.
References copyFile(), fileExists(), and mkdir().
| FileManager::copyFile | ( | $source, | |
| $dest | |||
| ) |
Copy a file.
| $source | string the source URL for the file |
| $dest | string the path where the file is to be saved |
Definition at line 174 of file FileManager.inc.php.
References fileExists(), mkdirtree(), and setMode().
Referenced by PKPPublicFileManager\copyContextFile(), copyDir(), PKPLibraryFileManager\copyFromTemporaryFile(), and IssueFileManager\fromTemporaryFile().
| FileManager::decompressFile | ( | $filePath | ) |
Decompress passed gziped file.
| $filePath | string |
Definition at line 572 of file FileManager.inc.php.
| FileManager::deleteByPath | ( | $filePath | ) |
Delete a file.
| $filePath | string the location of the file to be deleted |
Definition at line 291 of file FileManager.inc.php.
References HookRegistry\call(), and fileExists().
Referenced by PKPPublicFileManager\removeContextFile(), and PKPPublicFileManager\removeSiteFile().
| FileManager::downloadByPath | ( | $filePath, | |
$mediaType = null, |
|||
$inline = false, |
|||
$fileName = null |
|||
| ) |
Download a file. Outputs HTTP headers and file content for download
| $filePath | string the location of the file to be sent |
| $mediaType | string the MIME type of the file, optional |
| $inline | boolean print file as inline instead of attachment, optional |
| $fileName | string Optional filename to use on the client side |
Definition at line 256 of file FileManager.inc.php.
References HookRegistry\call(), PKPString\mime_content_type(), and readFileFromPath().
| FileManager::fileExists | ( | $filePath, | |
$type = 'file' |
|||
| ) |
Check if a file path is valid;
| $filePath | string the file/directory to check |
| $type | string (file|dir) the type of path |
Definition at line 375 of file FileManager.inc.php.
Referenced by SubmissionFileManager\_handleCopy(), copyDir(), copyFile(), deleteByPath(), TemporaryFileManager\handleUpload(), TemporaryFileManager\submissionToTemporaryFile(), uploadFile(), and writeFile().
| FileManager::getDocumentExtension | ( | $type | ) |
Returns file extension associated with the given document type, or false if the type does not belong to a recognized document type.
| $type | string |
Definition at line 428 of file FileManager.inc.php.
| FileManager::getDocumentType | ( | $type | ) |
Returns a file type, based on generic categories defined above
| $type | String |
Definition at line 391 of file FileManager.inc.php.
References getImageExtension().
| FileManager::getExtension | ( | $fileName | ) |
Parse file extension from file name.
| string | a valid file name |
Definition at line 498 of file FileManager.inc.php.
Referenced by PKPLibraryFileManager\generateFileName(), and truncateFileName().
| FileManager::getFirstUploadedPostName | ( | ) |
Get the filename of the first uploaded file in the $_FILES array. The returned filename is the value used in the form that submitted the request.
Definition at line 79 of file FileManager.inc.php.
| FileManager::getImageExtension | ( | $type | ) |
Returns file extension associated with the given image type, or false if the type does not belong to a recognized image type.
| $type | string |
Definition at line 450 of file FileManager.inc.php.
Referenced by getDocumentType().
| FileManager::getNiceFileSize | ( | $size | ) |
Return pretty file size string (in B, KB, MB, or GB units).
| $size | int file size in bytes |
Definition at line 522 of file FileManager.inc.php.
| FileManager::getUploadedFileName | ( | $fileName | ) |
Return the user-specific (not temporary) filename of an uploaded file.
| $fileName | string the name of the file used in the POST form |
Definition at line 100 of file FileManager.inc.php.
Referenced by SubmissionFileManager\_handleUpload(), and TemporaryFileManager\handleUpload().
| FileManager::getUploadedFilePath | ( | $fileName | ) |
Return the (temporary) path to an uploaded file.
| $fileName | string the name of the file used in the POST form |
Definition at line 88 of file FileManager.inc.php.
Referenced by SubmissionFileManager\_handleUpload().
| FileManager::getUploadedFileType | ( | $fileName | ) |
Return the type of an uploaded file.
| $fileName | string the name of the file used in the POST form |
Definition at line 112 of file FileManager.inc.php.
References PKPString\mime_content_type().
Referenced by SubmissionFileManager\_handleUpload().
| FileManager::getUploadErrorCode | ( | $fileName | ) |
Get the error code of a file upload
| $fileName | string the name of the file used in the POST form |
Definition at line 70 of file FileManager.inc.php.
| FileManager::mkdir | ( | $dirPath, | |
$perms = null |
|||
| ) |
Create a new directory.
| $dirPath | string the full path of the directory to be created |
| $perms | string the permissions level of the directory (optional) |
Definition at line 306 of file FileManager.inc.php.
References setMode().
Referenced by copyDir(), and mkdirtree().
| FileManager::mkdirtree | ( | $dirPath, | |
$perms = null |
|||
| ) |
Create a new directory, including all intermediate directories if required (equivalent to "mkdir -p")
| $dirPath | string the full path of the directory to be created |
| $perms | string the permissions level of the directory (optional) |
Definition at line 355 of file FileManager.inc.php.
References fatalError(), and mkdir().
Referenced by copyFile(), TemporaryFileManager\handleUpload(), TemporaryFileManager\submissionToTemporaryFile(), uploadFile(), and writeFile().
| FileManager::parseFileExtension | ( | $fileName | ) |
Parse the file extension from a filename/path.
| $fileName | string |
Definition at line 548 of file FileManager.inc.php.
Referenced by IssueFileManager\fromTemporaryFile(), TemporaryFileManager\handleUpload(), and TemporaryFileManager\submissionToTemporaryFile().
| FileManager::readFileFromPath | ( | $filePath, | |
$output = false |
|||
| ) |
Read a file's contents.
| $filePath | string the location of the file to be read |
| $output | boolean output the file's contents instead of returning a string |
Definition at line 227 of file FileManager.inc.php.
Referenced by downloadByPath().
| FileManager::rmdir | ( | $dirPath | ) |
Remove a directory.
| $dirPath | string the full path of the directory to be delete |
Definition at line 321 of file FileManager.inc.php.
Referenced by rmtree().
| FileManager::rmtree | ( | $file | ) |
Delete all contents including directory (equivalent to "rm -r")
| $file | string the full path of the directory to be removed |
Definition at line 330 of file FileManager.inc.php.
References rmdir().
| FileManager::setMode | ( | $path, | |
| $mask | |||
| ) |
Set file/directory mode based on the 'umask' config setting.
| $path | string |
| $mask | int |
Definition at line 536 of file FileManager.inc.php.
References Config\getVar().
Referenced by copyFile(), mkdir(), uploadFile(), and writeFile().
| FileManager::truncateFileName | ( | $fileName, | |
$length = 127 |
|||
| ) |
Truncate a filename to fit in the specified length.
Definition at line 510 of file FileManager.inc.php.
References getExtension(), PKPString\strlen(), and PKPString\substr().
Referenced by SubmissionFileManager\_handleCopy(), SubmissionFileManager\_handleUpload(), PKPLibraryFileManager\generateFileName(), and TemporaryFileManager\handleUpload().
| FileManager::uploadedFileExists | ( | $fileName | ) |
Return true if an uploaded file exists.
| $fileName | string the name of the file used in the POST form |
Definition at line 47 of file FileManager.inc.php.
Referenced by SubmissionFileManager\_handleUpload().
| FileManager::uploadError | ( | $fileName | ) |
Return true iff an error occurred when trying to upload a file.
| $fileName | string the name of the file used in the POST form |
Definition at line 60 of file FileManager.inc.php.
| FileManager::uploadFile | ( | $fileName, | |
| $destFileName | |||
| ) |
Upload a file.
| $fileName | string the name of the file used in the POST form |
| $dest | string the path where the file is to be saved |
Definition at line 134 of file FileManager.inc.php.
References fileExists(), mkdirtree(), and setMode().
Referenced by TemporaryFileManager\handleUpload(), PKPPublicFileManager\uploadContextFile(), and PKPPublicFileManager\uploadSiteFile().
| FileManager::writeFile | ( | $dest, | |
| & | $contents | ||
| ) |
Write a file.
| $dest | string the path where the file is to be saved |
| $contents | string the contents to write to the file |
Definition at line 152 of file FileManager.inc.php.
References fileExists(), mkdirtree(), and setMode().
Referenced by PKPPublicFileManager\writeContextFile().