
Provides file manipulation functionality for fActiveRecord classes
1.0.0b30 | Updated code for the new fUpload API 8/24/11 |
---|---|
1.0.0b29 | Fixed a bug when uploading a new file to a column with an existing file that was not found on the filesystem 5/10/11 |
1.0.0b28 | Backwards Compatibility Break - configureImageUploadColumn() no longer accepts the optional $image_type as the fourth parameter, instead addFImageMethodCall() must be called with saveChanges as the $method and the image type as the first parameter 11/30/10 |
1.0.0b27 | Fixed column inheritance to properly handle non-images and inheriting into image upload columns 9/18/10 |
1.0.0b26 | Enhanced configureColumnInheritance() to ensure both columns specified have been set up as file upload columns 8/18/10 |
1.0.0b25 | Updated code to work with the new fORM API 8/6/10 |
1.0.0b24 | Changed validation messages array to use column name keys 5/26/10 |
1.0.0b23 | Fixed a bug with upload() that could cause a method called on a non-object error in relation to the upload directory not being defined 5/10/10 |
1.0.0b22 | Updated the TEMP_DIRECTORY constant to not include the trailing slash, code now uses DIRECTORY_SEPARATOR to fix issues on Windows 4/28/10 |
1.0.0b21 | Fixed set() to perform column inheritance, just like upload() does 3/15/10 |
1.0.0b20 | Fixed the set and process methods to return the record instance, changed upload methods to return the fFile object, updated reflect() with new return values 3/15/10 |
1.0.0b19 | Fixed a few missed instances of old fFile method names 12/16/09 |
1.0.0b18 | Updated code for the new fFile API 12/16/09 |
1.0.0b17 | Updated code for the new fORMDatabase and fORMSchema APIs 10/28/09 |
1.0.0b16 | fImage method calls for file upload columns will no longer cause notices due to a missing image type 9/9/09 |
1.0.0b15 | addFImageMethodCall() no longer requires column be an image upload column, inheritance to an image column now only happens for fImage objects 7/29/09 |
1.0.0b14 | Updated to use new fORM::registerInspectCallback() method 7/13/09 |
1.0.0b13 | Updated code for new fORM API 6/15/09 |
1.0.0b12 | Changed replacement values in preg_replace() calls to be properly escaped 6/11/09 |
1.0.0b11 | Updated code to use new fValidationException::formatField() method 6/4/09 |
1.0.0b10 | Fixed a bug where an inherited file upload column would not be properly re-set with an existing- input 5/26/09 |
1.0.0b9 | upload() and set() now set the $values entry to NULL for filenames that are empty 3/2/09 |
1.0.0b8 | Changed set() to accept objects and reject directories 1/21/09 |
1.0.0b7 | Changed the class to use the new fFilesystem::createObject() method 1/21/09 |
1.0.0b6 | Old files are now checked against the current file to prevent removal of an in-use file 12/23/08 |
1.0.0b5 | Fixed replicate() to ensure the temp directory exists and set() to use the temp directory 12/23/08 |
1.0.0b4 | objectify() no longer throws an exception when a file can't be found 12/18/08 |
1.0.0b3 | Added replicate() so that replicated files get pu in the temp directory 12/12/08 |
1.0.0b2 | Fixed a bug with objectifying file columns 11/24/08 |
1.0.0b | The initial implementation 5/28/08 |
Please note: this constant is primarily intended for internal use by Flourish and will normally not be useful in site/application code
The temporary directory to use for various tasks
Adds an fImage method call to the image manipulation for a column if an image file is uploaded
Any call to fImage::saveChanges() will be called last. If no explicit method call to fImage::saveChanges() is made, it will be called implicitly with default parameters.
void addFImageMethodCall( mixed $class, string $column, string $method, array $parameters=array() )
mixed | $class | The class name or instance of the class |
string | $column | The column to call the method for |
string | $method | The fImage method to call |
array | $parameters | The parameters to pass to the method |
void addFUploadMethodCall( mixed $class, string $column, string $method, array $parameters=array() )
mixed | $class | The class name or instance of the class |
string | $column | The column to call the method for |
string | $method | The fUpload method to call |
array | $parameters | The parameters to pass to the method |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Begins a transaction, or increases the level
void begin( )
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Commits a transaction, or decreases the level
void commit( )
Takes one file or image upload columns and sets it to inherit any uploaded/set files from another column
void configureColumnInheritance( mixed $class, string $column, string $inherit_from_column )
mixed | $class | The class name or instance of the class |
string | $column | The column that will inherit the uploaded file |
string | $inherit_from_column | The column to inherit the uploaded file from |
Sets a column to be a file upload column
Configuring a column to be a file upload column means that whenever fActiveRecord::populate() is called for an fActiveRecord object, any appropriately named file uploads (via $_FILES) will be moved into the directory for this column.
Setting the column to a file path will cause the specified file to be copied into the directory for this column.
void configureFileUploadColumn( mixed $class, string $column, fDirectory|string $directory )
mixed | $class | The class name or instance of the class |
string | $column | The column to set as a file upload column |
fDirectory|string | $directory | The directory to upload/move to |
Sets a column to be an image upload column
This method works exactly the same as configureFileUploadColumn() except that only image files are accepted.
To alter an image, including the file type, use addFImageMethodCall().
void configureImageUploadColumn( mixed $class, string $column, fDirectory|string $directory )
mixed | $class | The class name or instance of the class |
string | $column | The column to set as a file upload column |
fDirectory|string | $directory | The directory to upload to |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Deletes the files for this record
void delete( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache )
fActiveRecord | $object | The fActiveRecord instance |
array | &$values | The current values |
array | &$old_values | The old values |
array | &$related_records | Any records related to this record |
array | &$cache | The cache array for the record |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Deletes old files for this record that have been replaced by new ones
void deleteOld( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache )
fActiveRecord | $object | The fActiveRecord instance |
array | &$values | The current values |
array | &$old_values | The old values |
array | &$related_records | Any records related to this record |
array | &$cache | The cache array for the record |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Encodes a file for output into an HTML input tag
void encode( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache, string $method_name, array $parameters )
fActiveRecord | $object | The fActiveRecord instance |
array | &$values | The current values |
array | &$old_values | The old values |
array | &$related_records | Any records related to this record |
array | &$cache | The cache array for the record |
string | $method_name | The method that was called |
array | $parameters | The parameters passed to the method |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Adds metadata about features added by this class
void inspect( string $class, string $column, array &$metadata )
string | $class | The class being inspected |
string | $column | The column being inspected |
array | &$metadata | The array of metadata about a column |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Moves uploaded files from the temporary directory to the permanent directory
void moveFromTemp( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache )
fActiveRecord | $object | The fActiveRecord instance |
array | &$values | The current values |
array | &$old_values | The old values |
array | &$related_records | Any records related to this record |
array | &$cache | The cache array for the record |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
mixed objectify( string $class, string $column, mixed $value )
string | $class | The class this value is for |
string | $column | The column the value is in |
mixed | $value | The value |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Performs the upload action for file uploads during fActiveRecord::populate()
void populate( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache )
fActiveRecord | $object | The fActiveRecord instance |
array | &$values | The current values |
array | &$old_values | The old values |
array | &$related_records | Any records related to this record |
array | &$cache | The cache array for the record |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Prepares a file for output into HTML by returning filename or the web server path to the file
void prepare( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache, string $method_name, array $parameters )
fActiveRecord | $object | The fActiveRecord instance |
array | &$values | The current values |
array | &$old_values | The old values |
array | &$related_records | Any records related to this record |
array | &$cache | The cache array for the record |
string | $method_name | The method that was called |
array | $parameters | The parameters passed to the method |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Handles re-processing an existing image file
fActiveRecord process( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache, string $method_name, array $parameters )
fActiveRecord | $object | The fActiveRecord instance |
array | &$values | The current values |
array | &$old_values | The old values |
array | &$related_records | Any records related to this record |
array | &$cache | The cache array for the record |
string | $method_name | The method that was called |
array | $parameters | The parameters passed to the method |
The record object, to allow for method chaining
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Performs image manipulation on an uploaded/set image
void processImage( string $class, string $column, fFile $image )
string | $class | The name of the class we are manipulating the image for |
string | $column | The column the image is assigned to |
fFile | $image | The image object to manipulate |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Adjusts the fActiveRecord::reflect() signatures of columns that have been configured in this class
void reflect( string $class, array &$signatures, boolean $include_doc_comments )
string | $class | The class to reflect |
array | &$signatures | The associative array of {method name} => {signature} |
boolean | $include_doc_comments | If doc comments should be included with the signature |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Creates a copy of an uploaded file in the temp directory for the newly cloned record
mixed replicate( string $class, string $column, mixed $value )
string | $class | The class this value is for |
string | $column | The column the value is in |
mixed | $value | The value |
The cloned fFile object
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Resets the configuration of the class
void reset( )
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Rolls back a transaction, or decreases the level
void rollback( )
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Copies a file from the filesystem to the file upload directory and sets it as the file for the specified column
This method will perform the fImage calls defined for the column.
fActiveRecord set( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache, string $method_name, array $parameters )
fActiveRecord | $object | The fActiveRecord instance |
array | &$values | The current values |
array | &$old_values | The old values |
array | &$related_records | Any records related to this record |
array | &$cache | The cache array for the record |
string | $method_name | The method that was called |
array | $parameters | The parameters passed to the method |
The record object, to allow for method chaining
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Uploads a file
fFile upload( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache, string $method_name, array $parameters )
fActiveRecord | $object | The fActiveRecord instance |
array | &$values | The current values |
array | &$old_values | The old values |
array | &$related_records | Any records related to this record |
array | &$cache | The cache array for the record |
string | $method_name | The method that was called |
array | $parameters | The parameters passed to the method |
The uploaded file
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Validates uploaded files to ensure they match all of the criteria defined
void validate( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache, array &$validation_messages )
fActiveRecord | $object | The fActiveRecord instance |
array | &$values | The current values |
array | &$old_values | The old values |
array | &$related_records | Any records related to this record |
array | &$cache | The cache array for the record |
array | &$validation_messages | The existing validation messages |