Elgg  Version 1.11
Namespaces | Functions | Variables
filestore.php File Reference

Go to the source code of this file.

Namespaces

 Elgg\Core
 Activate a plugin or plugins.
 

Functions

 get_dir_size ($dir, $total_size=0)
 Get the size of the specified directory. More...
 
 get_uploaded_file ($input_name)
 Get the contents of an uploaded file. More...
 
 get_resized_image_from_uploaded_file ($input_name, $maxwidth, $maxheight, $square=false, $upscale=false)
 Gets the jpeg contents of the resized version of an uploaded image (Returns false if the uploaded file was not an image) More...
 
 get_resized_image_from_existing_file ($input_name, $maxwidth, $maxheight, $square=false, $x1=0, $y1=0, $x2=0, $y2=0, $upscale=false)
 Gets the jpeg contents of the resized version of an already uploaded image (Returns false if the file was not an image) More...
 
 get_image_resize_parameters ($width, $height, $options)
 Calculate the parameters for resizing an image. More...
 
 file_delete ($guid)
 Delete an file. More...
 
 delete_directory ($directory)
 Delete a directory and all its contents. More...
 
 _elgg_clear_entity_files ($entity)
 Removes all entity files. More...
 
 get_default_filestore ()
 Return the default filestore. More...
 
 set_default_filestore (\ElggFilestore $filestore)
 Set the default filestore for the system. More...
 
 elgg_get_file_simple_type ($mime_type)
 Returns the category of a file from its MIME type. More...
 
 _elgg_filestore_init ()
 Initialize the file library. More...
 
 _elgg_filestore_detect_mimetype ($hook, $type, $mime_type, $params)
 Fix MIME type detection for Microsoft zipped formats. More...
 
 _elgg_filestore_parse_simpletype ($hook, $type, $simple_type, $params)
 Parse a file category of file from a MIME type. More...
 
 _elgg_filestore_test ($hook, $type, $value)
 Unit tests for files. More...
 

Variables

 $DEFAULT_FILE_STORE = null
 Variable holding the default datastore. More...
 
return function (\Elgg\EventsService $events,\Elgg\HooksRegistrationService $hooks)
 

Function Documentation

_elgg_clear_entity_files (   $entity)

Removes all entity files.

Warning
This only deletes the physical files and not their entities. This will result in FileExceptions being thrown. Don't use this function.
This must be kept in sync with .
Parameters
\ElggEntity$entityAn
Returns
void private

Definition at line 415 of file filestore.php.

_elgg_filestore_detect_mimetype (   $hook,
  $type,
  $mime_type,
  $params 
)

Fix MIME type detection for Microsoft zipped formats.

Parameters
string$hook"mime_type"
string$type"file"
string$mime_typeDetected MIME type
array$paramsHook parameters
Returns
string The MIME type private

Definition at line 502 of file filestore.php.

_elgg_filestore_init ( )

Initialize the file library.

Listens to system init and configures the default filestore

Returns
void private

Definition at line 473 of file filestore.php.

_elgg_filestore_parse_simpletype (   $hook,
  $type,
  $simple_type,
  $params 
)

Parse a file category of file from a MIME type.

Parameters
string$hook"simple_type"
string$type"file"
string$simple_typeThe category of file
array$paramsHook parameters
Returns
string 'document', 'audio', 'video', or 'general' if the MIME type is unrecognized private

Definition at line 543 of file filestore.php.

_elgg_filestore_test (   $hook,
  $type,
  $value 
)

Unit tests for files.

Parameters
string$hookunit_test
string$typesystem
mixed$valueArray of tests
Returns
array private

Definition at line 578 of file filestore.php.

delete_directory (   $directory)

Delete a directory and all its contents.

Parameters
string$directoryDirectory to delete
Returns
bool

Definition at line 371 of file filestore.php.

elgg_get_file_simple_type (   $mime_type)

Returns the category of a file from its MIME type.

Parameters
string$mime_typeThe MIME type
Returns
string 'document', 'audio', 'video', or 'general' if the MIME type was unrecognized
Since
1.10

Definition at line 461 of file filestore.php.

file_delete (   $guid)

Delete an file.

Parameters
int$guidGUID
Returns
bool

Definition at line 333 of file filestore.php.

get_default_filestore ( )

Return the default filestore.

Returns

Definition at line 432 of file filestore.php.

get_dir_size (   $dir,
  $total_size = 0 
)

Get the size of the specified directory.

Parameters
string$dirThe full path of the directory
int$total_sizeAdd to current dir size
Returns
int The size of the directory in bytes

Definition at line 18 of file filestore.php.

get_image_resize_parameters (   $width,
  $height,
  $options 
)

Calculate the parameters for resizing an image.

Parameters
int$widthWidth of the original image
int$heightHeight of the original image
array$optionsSee $defaults for the options
Returns
array or false
Since
1.7.2

Definition at line 210 of file filestore.php.

get_resized_image_from_existing_file (   $input_name,
  $maxwidth,
  $maxheight,
  $square = false,
  $x1 = 0,
  $y1 = 0,
  $x2 = 0,
  $y2 = 0,
  $upscale = false 
)

Gets the jpeg contents of the resized version of an already uploaded image (Returns false if the file was not an image)

Parameters
string$input_nameThe name of the file on the disk
int$maxwidthThe desired width of the resized image
int$maxheightThe desired height of the resized image
bool$squareIf set to true, takes the smallest of maxwidth and maxheight and use it to set the dimensions on the new image. If no crop parameters are set, the largest square that fits in the image centered will be used for the resize. If square, the crop must be a square region.
int$x1x coordinate for top, left corner
int$y1y coordinate for top, left corner
int$x2x coordinate for bottom, right corner
int$y2y coordinate for bottom, right corner
bool$upscaleResize images smaller than $maxwidth x $maxheight?
Returns
false|mixed The contents of the resized image, or false on failure

Definition at line 115 of file filestore.php.

get_resized_image_from_uploaded_file (   $input_name,
  $maxwidth,
  $maxheight,
  $square = false,
  $upscale = false 
)

Gets the jpeg contents of the resized version of an uploaded image (Returns false if the uploaded file was not an image)

Parameters
string$input_nameThe name of the file input field on the submission form
int$maxwidthThe maximum width of the resized image
int$maxheightThe maximum height of the resized image
bool$squareIf set to true, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
bool$upscaleResize images smaller than $maxwidth x $maxheight?
Returns
false|mixed The contents of the resized image, or false on failure

Definition at line 75 of file filestore.php.

get_uploaded_file (   $input_name)

Get the contents of an uploaded file.

(Returns false if there was an issue.)

Parameters
string$input_nameThe name of the file input field on the submission form
Returns
mixed|false The contents of the file, or false on failure.

Definition at line 43 of file filestore.php.

set_default_filestore ( \ElggFilestore  $filestore)

Set the default filestore for the system.

Parameters
\ElggFilestore$filestoreAn object.
Returns
true

Definition at line 445 of file filestore.php.

Variable Documentation

$DEFAULT_FILE_STORE = null

Variable holding the default datastore.

Definition at line 425 of file filestore.php.

Definition at line 584 of file filestore.php.