XOOPS  2.6.0
Xoops\Core\MediaUploader Class Reference
Inheritance diagram for Xoops\Core\MediaUploader:
Inheritance graph

Public Member Functions

 __construct ($uploadDir, $allowedMimeTypes, $maxFileSize=0, $maxWidth=null, $maxHeight=null)
 
 checkImageType ()
 
 checkMaxFileSize ()
 
 checkMaxHeight ()
 
 checkMaxWidth ()
 
 checkMimeType ()
 
 fetchMedia ($media_name, $index=null)
 
 getErrors ($ashtml=true)
 
 getMediaName ()
 
 getMediaSize ()
 
 getMediaTmpName ()
 
 getMediaType ()
 
 getSavedDestination ()
 
 getSavedFileName ()
 
 sanitizeMultipleExtensions ()
 
 setErrors ($error)
 
 setPrefix ($value)
 
 setTargetFileName ($value)
 
 upload ($chmod=0644)
 

Public Attributes

 $allowedMimeTypes = array()
 
 $allowUnknownTypes = false
 
 $checkImageType = true
 
 $deniedMimeTypes
 
 $errors = array()
 
 $extensionsToBeSanitized
 
 $imageExtensions
 
 $maxFileSize = 0
 
 $maxHeight
 
 $maxWidth
 
 $mediaError
 
 $mediaName
 
 $mediaRealType = ''
 
 $mediaSize
 
 $mediaTmpName
 
 $mediaType
 
 $prefix
 
 $savedDestination
 
 $savedFileName
 
 $targetFileName
 
 $uploadDir = ''
 

Protected Member Functions

 copyFile ($chmod)
 

Detailed Description

Definition at line 63 of file MediaUploader.php.

Constructor & Destructor Documentation

Xoops\Core\MediaUploader::__construct (   $uploadDir,
  $allowedMimeTypes,
  $maxFileSize = 0,
  $maxWidth = null,
  $maxHeight = null 
)

Constructor

Parameters
string$uploadDirupload directory
array$allowedMimeTypesallowed mime types
int$maxFileSizemax size
int$maxWidthmax width
int$maxHeightmax height

Definition at line 195 of file MediaUploader.php.

References Xoops\Core\MediaUploader\$allowedMimeTypes, Xoops\Core\MediaUploader\$maxFileSize, Xoops\Core\MediaUploader\$maxHeight, Xoops\Core\MediaUploader\$maxWidth, and Xoops\Core\MediaUploader\$uploadDir.

Member Function Documentation

Xoops\Core\MediaUploader::checkImageType ( )

Check whether or not the uploaded image type is valid

Returns
bool

Definition at line 525 of file MediaUploader.php.

References XoopsLocaleEn_US\E_INVALID_IMAGE_FILE, and Xoops\Core\MediaUploader\setErrors().

Referenced by Xoops\Core\MediaUploader\upload().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Core\MediaUploader::checkMaxFileSize ( )

Is the file the right size?

Returns
bool

Definition at line 443 of file MediaUploader.php.

References XoopsLocaleEn_US\EF_FILE_SIZE_TO_LARGE, and Xoops\Core\MediaUploader\setErrors().

Referenced by Xoops\Core\MediaUploader\upload().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Core\MediaUploader::checkMaxHeight ( )

Is the picture the right height?

Returns
bool

Definition at line 481 of file MediaUploader.php.

References XoopsLocaleEn_US\EF_FILE_HEIGHT_TO_LARGE, XoopsLocaleEn_US\EF_IMAGE_SIZE_NOT_FETCHED, and Xoops\Core\MediaUploader\setErrors().

Referenced by Xoops\Core\MediaUploader\upload().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Core\MediaUploader::checkMaxWidth ( )

Is the picture the right width?

Returns
bool

Definition at line 460 of file MediaUploader.php.

References XoopsLocaleEn_US\EF_FILE_WIDTH_TO_LARGE, XoopsLocaleEn_US\EF_IMAGE_SIZE_NOT_FETCHED, and Xoops\Core\MediaUploader\setErrors().

Referenced by Xoops\Core\MediaUploader\upload().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Core\MediaUploader::checkMimeType ( )

Check whether or not the uploaded file type is allowed

Returns
bool

Definition at line 502 of file MediaUploader.php.

References XoopsLocaleEn_US\E_FILE_TYPE_REJECTED, XoopsLocaleEn_US\EF_FILE_MIME_TYPE_NOT_ALLOWED, and Xoops\Core\MediaUploader\setErrors().

Referenced by Xoops\Core\MediaUploader\upload().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Core\MediaUploader::copyFile (   $chmod)
protected

Copy the file to its destination

Parameters
int$chmodfile permissions to set
Returns
bool

Definition at line 402 of file MediaUploader.php.

References $ext, $info, Xoops\Core\MediaUploader\$savedFileName, Xoops\Core\MediaUploader\$targetFileName, XoopsLocaleEn_US\E_INVALID_FILE_NAME, XoopsLocaleEn_US\E_SUSPICIOUS_IMAGE_UPLOAD_REFUSED, XoopsLocaleEn_US\EF_FILE_NOT_SAVED_TO, and Xoops\Core\MediaUploader\setErrors().

Referenced by Xoops\Core\MediaUploader\upload().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Core\MediaUploader::fetchMedia (   $media_name,
  $index = null 
)

Fetch the uploaded file

Parameters
string$media_nameName of the file field
int$indexIndex of the file (if more than one uploaded under that name)
Returns
bool

Definition at line 218 of file MediaUploader.php.

References $ext, $index, $path_parts, XoopsLocaleEn_US\E_FILE_NAME_MISSING, XoopsLocaleEn_US\E_FILE_NOT_FOUND, XoopsLocaleEn_US\E_INVALID_FILE_SIZE, XoopsLocaleEn_US\EF_UNEXPECTED_ERROR, XoopsLocaleEn_US\NO_FILE_UPLOADED, and Xoops\Core\MediaUploader\setErrors().

Here is the call graph for this function:

Xoops\Core\MediaUploader::getErrors (   $ashtml = true)

Get generated errors

Parameters
bool$ashtmlFormat using HTML?
Returns
array |string Array of array messages OR HTML string

Definition at line 582 of file MediaUploader.php.

References $error, Xoops\Core\MediaUploader\$errors, and XoopsLocaleEn_US\EF_ERRORS_RETURNED_WHILE_UPLOADING_FILE.

Xoops\Core\MediaUploader::getMediaName ( )

Get the uploaded filename

Returns
string

Definition at line 296 of file MediaUploader.php.

References Xoops\Core\MediaUploader\$mediaName.

Xoops\Core\MediaUploader::getMediaSize ( )

Get the size of the uploaded file

Returns
int

Definition at line 316 of file MediaUploader.php.

References Xoops\Core\MediaUploader\$mediaSize.

Xoops\Core\MediaUploader::getMediaTmpName ( )

Get the temporary name that the uploaded file was stored under

Returns
string

Definition at line 326 of file MediaUploader.php.

References Xoops\Core\MediaUploader\$mediaTmpName.

Xoops\Core\MediaUploader::getMediaType ( )

Get the type of the uploaded file

Returns
string

Definition at line 306 of file MediaUploader.php.

References Xoops\Core\MediaUploader\$mediaType.

Xoops\Core\MediaUploader::getSavedDestination ( )

Get the destination the file is saved to

Returns
string

Definition at line 346 of file MediaUploader.php.

References Xoops\Core\MediaUploader\$savedDestination.

Xoops\Core\MediaUploader::getSavedFileName ( )

Get the saved filename

Returns
string

Definition at line 336 of file MediaUploader.php.

References Xoops\Core\MediaUploader\$savedFileName.

Xoops\Core\MediaUploader::sanitizeMultipleExtensions ( )

Sanitize executable filename with multiple extensions

Returns
void

Definition at line 548 of file MediaUploader.php.

References $ext.

Referenced by Xoops\Core\MediaUploader\upload().

Here is the caller graph for this function:

Xoops\Core\MediaUploader::setErrors (   $error)
Xoops\Core\MediaUploader::setPrefix (   $value)

Set the prefix

Parameters
string$valueprefix
Returns
void

Definition at line 286 of file MediaUploader.php.

Xoops\Core\MediaUploader::setTargetFileName (   $value)

Set the target filename

Parameters
string$valuefile name
Returns
void

Definition at line 274 of file MediaUploader.php.

Member Data Documentation

Xoops\Core\MediaUploader::$allowedMimeTypes = array()

Definition at line 110 of file MediaUploader.php.

Referenced by Xoops\Core\MediaUploader\__construct().

Xoops\Core\MediaUploader::$allowUnknownTypes = false

Definition at line 70 of file MediaUploader.php.

Xoops\Core\MediaUploader::$checkImageType = true

Definition at line 167 of file MediaUploader.php.

Xoops\Core\MediaUploader::$deniedMimeTypes
Initial value:
= array(
'application/x-httpd-php'
)

Definition at line 115 of file MediaUploader.php.

Xoops\Core\MediaUploader::$errors = array()

Definition at line 147 of file MediaUploader.php.

Referenced by Xoops\Core\MediaUploader\getErrors().

Xoops\Core\MediaUploader::$extensionsToBeSanitized
Initial value:
= array(
'php', 'phtml', 'phtm', 'php3', 'php4', 'cgi', 'pl', 'asp', 'php5'
)

Definition at line 172 of file MediaUploader.php.

Xoops\Core\MediaUploader::$imageExtensions
Initial value:
= array(
1 => 'gif', 2 => 'jpg', 3 => 'png', 4 => 'swf', 5 => 'psd', 6 => 'bmp', 7 => 'tif', 8 => 'tif', 9 => 'jpc',
10 => 'jp2', 11 => 'jpx', 12 => 'jb2', 13 => 'swf', 14 => 'iff', 15 => 'wbmp', 16 => 'xbm'
)

Definition at line 181 of file MediaUploader.php.

Xoops\Core\MediaUploader::$maxFileSize = 0

Definition at line 122 of file MediaUploader.php.

Referenced by Xoops\Core\MediaUploader\__construct().

Xoops\Core\MediaUploader::$maxHeight

Definition at line 132 of file MediaUploader.php.

Referenced by Xoops\Core\MediaUploader\__construct().

Xoops\Core\MediaUploader::$maxWidth

Definition at line 127 of file MediaUploader.php.

Referenced by Xoops\Core\MediaUploader\__construct().

Xoops\Core\MediaUploader::$mediaError

Definition at line 95 of file MediaUploader.php.

Xoops\Core\MediaUploader::$mediaName

Definition at line 75 of file MediaUploader.php.

Referenced by Xoops\Core\MediaUploader\getMediaName().

Xoops\Core\MediaUploader::$mediaRealType = ''

Definition at line 100 of file MediaUploader.php.

Xoops\Core\MediaUploader::$mediaSize

Definition at line 85 of file MediaUploader.php.

Referenced by Xoops\Core\MediaUploader\getMediaSize().

Xoops\Core\MediaUploader::$mediaTmpName

Definition at line 90 of file MediaUploader.php.

Referenced by Xoops\Core\MediaUploader\getMediaTmpName().

Xoops\Core\MediaUploader::$mediaType

Definition at line 80 of file MediaUploader.php.

Referenced by Xoops\Core\MediaUploader\getMediaType().

Xoops\Core\MediaUploader::$prefix

Definition at line 142 of file MediaUploader.php.

Xoops\Core\MediaUploader::$savedDestination

Definition at line 152 of file MediaUploader.php.

Referenced by Xoops\Core\MediaUploader\getSavedDestination().

Xoops\Core\MediaUploader::$savedFileName
Xoops\Core\MediaUploader::$targetFileName

Definition at line 137 of file MediaUploader.php.

Referenced by Xoops\Core\MediaUploader\copyFile().

Xoops\Core\MediaUploader::$uploadDir = ''

Definition at line 105 of file MediaUploader.php.

Referenced by Xoops\Core\MediaUploader\__construct().


The documentation for this class was generated from the following file: