![]() |
PHPDevShell 3.1.3-Stable
PHP OOP RAD Development Framework
|
Public Member Functions | |
| safeFileName ($filename, $replace= '_') | |
| getFileExtension ($filename) | |
| getFileBase ($filename) | |
| iconType ($extension_lookup) | |
| deleteFilename ($filename=false) | |
| createDateDirectory ($directory= '', $cmod= '0777', $custom_dir=false) | |
| writeFile ($filename, $data, $directory=false, $safename=true) | |
| uploadFile ($uploaded_filename, $directory, $new_filename) | |
| renameUniqueFilename ($filename, $extension=false) | |
| autoUpload ($input_name, $file_overwrite_id=false, $file_description= '', $file_explained= '') | |
| displayFilesize ($filesize) | |
| deleteFiles ($file_id=0, $alias= '', $sub_id=0, $menu_id=0) | |
| countFiles ($alias= '', $sub_id=0, $menu_id=0) | |
| loadFiles ($file_id=0, $alias= '', $sub_id=0, $menu_id=0, $order= 'file_id DESC', $limit= '0, 5') | |
| returnImageCopies ($file, $nr=0, $directory='') | |
| downloadFile ($url, $copy_to) | |
| zipExtract ($file, $extractPath) | |
| smartCopy ($source, $dest, $options=array('folder_permission'=> 0755, 'file_permission'=> 0644)) | |
| deleteDir ($dirname) | |
| establishFtp ($username='config', $password='config', $host='config', $port='config', $ssl='config', $timeout='config', $chdir='config') | |
| ftpRcopy ($conn_id, $src_dir, $dst_dir) | |
| getDirListing ($path= '.', $level=0) | |
Data Fields | |
| $logUploads = 'default' | |
| $defaultUploadDirectory = 'default' | |
| $cmod = 'default' | |
| $maxFilesize = 'default' | |
| $maxImagesize = 'default' | |
| $maxFileCount = 0 | |
| $allowedExt = 'default' | |
| $doCreateThumb = 'default' | |
| $imageQuality = 'default' | |
| $thumbnailType = 'default' | |
| $resizeAdaptiveDimension = 'default' | |
| $resizeThumbDimension = 'default' | |
| $resizeThumbPercent = 'default' | |
| $cropThumbFromcenter = 'default' | |
| $cropThumbDimension = 'default' | |
| $doThumbReflect = 'default' | |
| $thumbReflectSettings = 'default' | |
| $doCreateResizeImage = 'default' | |
| $resizeImageDimension = 'default' | |
| $alias | |
| $menuId | |
| $subId | |
| $groupId | |
| $convertPdf = false | |
| $convertDensity = '300' | |
| $graphicsEngine = 'gd' | |
| $imageCopies = array() | |
| $uploadHistory = array() | |
| $d = 'core.lang' | |
| $setting | |
This class handles file uploads in its simplest form.
| autoUpload | ( | $ | input_name, |
| $ | file_overwrite_id = false, |
||
| $ | file_description = '', |
||
| $ | file_explained = '' |
||
| ) |
Simplifies the whole process of uploading files with type=file.
| string | $input_name | The name of the <form type="file" name="???"> |
| string | $file_overwrite_id | The id of the log that needs to be overwritten. |
| string | $file_description | a Simple file description for uploaded item. |
| string | $file_explained | Explaining in text what this uploaded file is about. |
| countFiles | ( | $ | alias = '', |
| $ | sub_id = 0, |
||
| $ | menu_id = 0 |
||
| ) |
Count uploaded files from the log database.
| string | $alias | Load only files by this alias. |
| integer | $sub_id | Load only files by this sub_id. |
| integer | $menu_id | Load only files by this menu_id. |
| createDateDirectory | ( | $ | directory = '', |
| $ | cmod = '0777', |
||
| $ | custom_dir = false |
||
| ) |
Creates directory according to month and year.
| string | $directory | Writable directory where new directories will be created and files stored. |
| integer | $cmod | Example: 0777 |
| boolean | $custome_dir |
| deleteDir | ( | $ | dirname | ) |
Will delete a whole directory recursively (directory muste be writable).
| $dirname | Directory to delete. |
| deleteFilename | ( | $ | filename = false | ) |
Deletes a filename.
| string | $filename |
| deleteFiles | ( | $ | file_id = 0, |
| $ | alias = '', |
||
| $ | sub_id = 0, |
||
| $ | menu_id = 0 |
||
| ) |
Delete file logs from database.
| integer | $file_id | Get only a single file with a file_id. |
| string | $alias | Load only files by this alias. |
| integer | $sub_id | Load only files by this sub_id. |
| integer | $menu_id | Load only files by this menu_id. |
| displayFilesize | ( | $ | filesize | ) |
Convert numeric into file size.
| numeric | $filesize |
| downloadFile | ( | $ | url, |
| $ | copy_to | ||
| ) |
Enables the caller to download a file to a local writable directory.
| $url | The url to download from |
| $copy_to | The location to copy to add the name to the file too, example: /var/www/test.zip |
| establishFtp | ( | $ | username = 'config', |
| $ | password = 'config', |
||
| $ | host = 'config', |
||
| $ | port = 'config', |
||
| $ | ssl = 'config', |
||
| $ | timeout = 'config', |
||
| $ | chdir = 'config' |
||
| ) |
Connects to a normal ftp or secure server. If values left empty system will use PHPDevShell configuration values.
| $username | |
| $password | |
| $host | |
| $port | |
| $ssl | |
| $timeout | |
| $chdir |
| ftpRcopy | ( | $ | conn_id, |
| $ | src_dir, | ||
| $ | dst_dir | ||
| ) |
The following is a fully tested function (based on a previous note) that recursively puts files from a source directory to a destination directory. See http://rufy.com/tech/archives/000026.html for more information.
NOTE: Use full path name for the destination directory and the destination directory must already exist
| resource | $conn_id | |
| string | $src_dir | |
| string | $dst_dir |
| getDirListing | ( | $ | path = '.', |
| $ | level = 0 |
||
| ) |
Lists a directories sub directories. Skips files.
| string | The absolute path to check. $path |
| int | How deep scanning should occur. |
| getFileBase | ( | $ | filename | ) |
Get filename without extension.
| string | $filename |
| getFileExtension | ( | $ | filename | ) |
Get a files extension.
| string | $filename |
| iconType | ( | $ | extension_lookup | ) |
Takes a filename and checks what icon needs to go with it.
| string | $extension_lookup |
| loadFiles | ( | $ | file_id = 0, |
| $ | alias = '', |
||
| $ | sub_id = 0, |
||
| $ | menu_id = 0, |
||
| $ | order = 'file_id DESC', |
||
| $ | limit = '0, |
||
| 5' | |||
| ) |
Load uploaded files from the log database.
| integer | $file_id | Get only a single file with a file_id. |
| string | $alias | Load only files by this alias. |
| integer | $sub_id | Load only files by this sub_id. |
| integer | $menu_id | Load only files by this menu_id. |
| string | $order | What the query should be ordered by. allows you to order by any of these column values : file_id, sub_id, menu_id, alias, original_filename, new_filename, relative_path, thumbnail, resized, extention, mime_type, file_desc, group_id, user_id, date_stored |
| string | $limit | how many files should be returned in the array. |
| renameUniqueFilename | ( | $ | filename, |
| $ | extension = false |
||
| ) |
Creates unique and safe filename.
| returnImageCopies | ( | $ | file, |
| $ | nr = 0, |
||
| $ | directory = '' |
||
| ) |
Check if multiple images exists converted from a pdf with multiple pages.
| string | $file | |
| int | $nr | The current file number in the loop. |
| string | Add directy if you wish for only file to be returned. |
| safeFileName | ( | $ | filename, |
| $ | replace = '_' |
||
| ) |
This method simply renames the file to unix standards.
| string | $filename | |
| string | $replace | Replace odd characters with what? |
| smartCopy | ( | $ | source, |
| $ | dest, | ||
| $ | options = array('folder_permission' => 0755, 'file_permission' => 0644) |
||
| ) |
Copy file or folder from source to destination, it can do recursive copy as well and is very smart It recursively creates the dest file or directory path if there weren't exists Situtaions :
| $source | //file or folder |
| $dest | ///file or folder |
| $options | //folderPermission,filePermission |
| uploadFile | ( | $ | uploaded_filename, |
| $ | directory, | ||
| $ | new_filename | ||
| ) |
Move file from temp directory to specified directory.
| string | $uploaded_filename | |
| string | $directory | |
| string | $new_filename |
| writeFile | ( | $ | filename, |
| $ | data, | ||
| $ | directory = false, |
||
| $ | safename = true |
||
| ) |
Binary-safe file create, write and return filename path.
| string | $filename | |
| string | $data | |
| string | $directory |
| zipExtract | ( | $ | file, |
| $ | extractPath | ||
| ) |
Extracts a ZIP archive to the specified extract path
| string | $file | The ZIP archive to extract (including the path) |
| string | $extractPath | The path to extract the ZIP archive to |
| $alias |
| $allowedExt = 'default' |
| $cmod = 'default' |
| $convertDensity = '300' |
| $convertPdf = false |
| $cropThumbDimension = 'default' |
| $cropThumbFromcenter = 'default' |
| $d = 'core.lang' |
| $defaultUploadDirectory = 'default' |
| $doCreateResizeImage = 'default' |
| $doCreateThumb = 'default' |
| $doThumbReflect = 'default' |
| $graphicsEngine = 'gd' |
| $groupId |
| $imageCopies = array() |
| $imageQuality = 'default' |
| $logUploads = 'default' |
| $maxFileCount = 0 |
| $maxFilesize = 'default' |
| $maxImagesize = 'default' |
| $menuId |
| $resizeAdaptiveDimension = 'default' |
| $resizeImageDimension = 'default' |
| $resizeThumbDimension = 'default' |
| $resizeThumbPercent = 'default' |
| $setting |
| $subId |
| $thumbnailType = 'default' |
| $thumbReflectSettings = 'default' |
| $uploadHistory = array() |