ultimix

- Main Page
- Data Structures
- Files
- Examples

- Data Structures
- Data Structure Index
- Data Fields

Public Member Functions | Data Fields
file_input_algorithms_1_0_0 Class Reference

## Public Member Functions
| __construct ()
| get_extensions ($Type, $AsString=false)
| get_file_filters ($Type)
| get_by_id ($id)

## Data Fields
| $FileInputAccess = false
| $Security = false
| $Extensions = array()

## Detailed Description

Class provides file algorithms.

Author
  Dodonov A.A.

Definition at line 26 of file file_input_algorithms.php.

## Constructor & Destructor Documentation

__construct | ( |  | ) |

Constructor.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 57 of file file_input_algorithms.php.

{
try
{
$this->FileInputAccess = get_package( 'file_input::file_input_access' , 'last' , __FILE__ );
$this->Security = get_package( 'security' , 'last' , __FILE__ );
$this->Extensions[ 'default' ] = array( 'jpg' , 'jpeg' , 'gif' , 'bmp' , 'png' , 'tif' ,
'tiff' , 'doc' , 'docx' , 'ppt' , 'pptx' , 'rtf' , 'xls' , 'xslx' , 'pdf'
);
$this->Extensions[ 'images' ] = array(
'jpg' , 'jpeg' , 'gif' , 'bmp' , 'png' , 'tiff' , 'tif'
);
$this->Extensions[ 'archives' ] = array(
'zip' , '7zip' , 'gz' , 'gz2' , 'tar' , 'rar' , 'arc'
);
$this->Extensions[ 'all' ] = array( '*' );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

## Member Function Documentation

get_by_id | ( |  | $id | ) |

Function returns record by it's id.

Parameters

  $id | - Id of the searching record.

Returns
  Record.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 206 of file file_input_algorithms.php.

{
try
{
$id = $this->Security->get( $id , 'integer' );
$Records = $this->FileInputAccess->unsafe_select( "id = $id" );
if( count( $Records ) !== 1 )
{
throw( new Exception( 'An error occured while record fetching' ) );
}
else
{
return( $Records[ 0 ] );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

get_extensions | ( |  | $Type,
|  |  | $AsString = `false`
| ) |  |

Function returns a list of the uploading files.

Parameters

  $Type | - Type of uploading files.
  $AsString | - Type of the return value.

Returns
  List of extensions.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 110 of file file_input_algorithms.php.

{
try
{
$Extensions = array();
if( isset( $this->Extensions[ $Type ] ) === false )
{
throw( new Exception( "File type \"$Type\" is undefined" ) );
}
return(
$AsString ? '*.'.implode( ';*.' , $this->Extensions[ $Type ] ) : $this->Extensions[ $Type ]
);
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

get_file_filters | ( |  | $Type | ) |

Function returns filter.

Parameters

  $Type | - Type of uploading files.

Returns
  Filter.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 153 of file file_input_algorithms.php.

{
try
{
$FileExtensions = $this->get_extensions( $Type , true );
if( $Type == 'default' )
{
$FileDescription = 'Supported types';
}
elseif( $Type == 'images' )
{
$FileDescription = 'Images';
}
elseif( $Type == 'archives' )
{
$FileDescription = 'Zip archives';
}
elseif( $Type == 'all' )
{
$FileDescription = 'All files';
}
return( array( $FileExtensions , $FileDescription ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

## Field Documentation

$Extensions = array()

Definition at line 41 of file file_input_algorithms.php.

$FileInputAccess = false

Cached packages.

Author
  Dodonov A.A.

Definition at line 38 of file file_input_algorithms.php.

$Security = false

Definition at line 39 of file file_input_algorithms.php.

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

- packages/file_input/packages/file_input_algorithms/file_input_algorithms.php