class Transformations (View source)

Transformations class

Methods

array
getOptions(string $optionString)

Returns array of options from string with options separated by comma, removes quotes

array
getAvailableMimeTypes()

Gets all available MIME-types

string
getClassName(string $filename)

Returns the class name of the transformation

string
getDescription(string $file)

Returns the description of the transformation

string
getName(string $file)

Returns the name of the transformation

string
fixUpMime(string $value)

Fixups old MIME or transformation name to new one

array|null
getMime(string $db, string $table, bool $strict = false, bool $fullName = false)

Gets the mimetypes for all columns of a table

bool
setMime(string $db, string $table, string $key, string $mimetype, string $transformation, string $transformationOpts, string $inputTransform, string $inputTransformOpts, bool $forcedelete = false)

Set a single mimetype to a certain value.

bool
clear(string $db, string $table = '', string $column = '')

Delete related transformation details after deleting database. table or column

Details

array getOptions(string $optionString)

Returns array of options from string with options separated by comma, removes quotes

getOptions("'option ,, quoted',abd,'2,3',");
// array {
//     'option ,, quoted',
//     'abc',
//     '2,3',
//     '',
// }

Parameters

string $optionString

comma separated options

Return Value

array

options

array getAvailableMimeTypes()

Gets all available MIME-types

Return Value

array

array[mimetype], array[transformation]

string getClassName(string $filename)

Returns the class name of the transformation

Parameters

string $filename

transformation file name

Return Value

string

the class name of transformation

string getDescription(string $file)

Returns the description of the transformation

Parameters

string $file

transformation file

Return Value

string

the description of the transformation

string getName(string $file)

Returns the name of the transformation

Parameters

string $file

transformation file

Return Value

string

the name of the transformation

string fixUpMime(string $value)

Fixups old MIME or transformation name to new one

  • applies some hardcoded fixups
  • adds spaces after _ and numbers
  • capitalizes words
  • removes back spaces

Parameters

string $value

Value to fixup

Return Value

string

array|null getMime(string $db, string $table, bool $strict = false, bool $fullName = false)

Gets the mimetypes for all columns of a table

Parameters

string $db

the name of the db to check for

string $table

the name of the table to check for

bool $strict

whether to include only results having a mimetype set

bool $fullName

whether to use full column names as the key

Return Value

array|null

[field_name][field_key] = field_value

bool setMime(string $db, string $table, string $key, string $mimetype, string $transformation, string $transformationOpts, string $inputTransform, string $inputTransformOpts, bool $forcedelete = false)

Set a single mimetype to a certain value.

Parameters

string $db

the name of the db

string $table

the name of the table

string $key

the name of the column

string $mimetype

the mimetype of the column

string $transformation

the transformation of the column

string $transformationOpts

the transformation options of the column

string $inputTransform

the input transformation of the column

string $inputTransformOpts

the input transformation options of the column

bool $forcedelete

force delete, will erase any existing comments for this column

Return Value

bool

bool clear(string $db, string $table = '', string $column = '')

Delete related transformation details after deleting database. table or column

Parameters

string $db

Database name

string $table

Table name

string $column

Column name

Return Value

bool