FileModel
extends BaseModel
in package
Tags
Table of Contents
Constants
- _APPLICATION_NAME = "Magna Regula"
- _FORBIDDEN_CHARS = "."
- _MAX_HASH_LEVEL = 3
- _SEVERITY_KO = 2
- _SEVERITY_OK = 0
- _SEVERITY_TEXT = array(\BaseModel::_SEVERITY_OK => 'OK', \BaseModel::_SEVERITY_WARN => 'WARNING', \BaseModel::_SEVERITY_KO => 'KO')
- _SEVERITY_WARN = 1
- _TEXT_CODESET = "UTF-8"
- _TEXT_DOMAIN = "magnaregula"
- API_TOKEN_INVALID = 895
- API_TOKEN_NOT_ACTIVE = 897
- API_TOKEN_NOT_FOUND = 896
- API_TOKEN_TOO_OLD = 899
- API_TOKEN_TOO_YOUNG = 898
- IMAGE_HANDLERS = [\IMAGETYPE_JPEG => ['load' => 'imagecreatefromjpeg', 'save' => 'imagejpeg', 'quality' => 100], \IMAGETYPE_PNG => ['load' => 'imagecreatefrompng', 'save' => 'imagepng', 'quality' => 9], \IMAGETYPE_GIF => ['load' => 'imagecreatefromgif', 'save' => 'imagegif']]
Properties
- $_errormessages : mixed
Methods
- __() : mixed
- __construct() : mixed
- _add_last_slash_if_not() : mixed
- _add_slash_if_necessary() : mixed
- _append_to_file_static() : mixed
- _bindtextdomain() : mixed
- _build_block() : string
- Returns a block of text, with variables, replaced
- _build_structure_from_file() : mixed
- _create_hash_if_needed() : mixed
- _delete_hash_if_needed() : mixed
- _extract_extension() : mixed
- _get_errormessage() : mixed
- _hash_filepath() : mixed
- _switch_text_to_locale() : mixed
- _translate_text() : string
- Translate a text, by calling __()
- getGUID() : mixed
- getGUIDv2() : mixed
- is_dir_empty() : mixed
- thumbnailImage() : mixed
Constants
_APPLICATION_NAME
public
mixed
_APPLICATION_NAME
= "Magna Regula"
_FORBIDDEN_CHARS
public
mixed
_FORBIDDEN_CHARS
= "."
_MAX_HASH_LEVEL
public
mixed
_MAX_HASH_LEVEL
= 3
_SEVERITY_KO
public
mixed
_SEVERITY_KO
= 2
_SEVERITY_OK
public
mixed
_SEVERITY_OK
= 0
_SEVERITY_TEXT
public
mixed
_SEVERITY_TEXT
= array(\BaseModel::_SEVERITY_OK => 'OK', \BaseModel::_SEVERITY_WARN => 'WARNING', \BaseModel::_SEVERITY_KO => 'KO')
_SEVERITY_WARN
public
mixed
_SEVERITY_WARN
= 1
_TEXT_CODESET
public
mixed
_TEXT_CODESET
= "UTF-8"
_TEXT_DOMAIN
public
mixed
_TEXT_DOMAIN
= "magnaregula"
API_TOKEN_INVALID
public
mixed
API_TOKEN_INVALID
= 895
API_TOKEN_NOT_ACTIVE
public
mixed
API_TOKEN_NOT_ACTIVE
= 897
API_TOKEN_NOT_FOUND
public
mixed
API_TOKEN_NOT_FOUND
= 896
API_TOKEN_TOO_OLD
public
mixed
API_TOKEN_TOO_OLD
= 899
API_TOKEN_TOO_YOUNG
public
mixed
API_TOKEN_TOO_YOUNG
= 898
IMAGE_HANDLERS
public
mixed
IMAGE_HANDLERS
= [\IMAGETYPE_JPEG => ['load' => 'imagecreatefromjpeg', 'save' => 'imagejpeg', 'quality' => 100], \IMAGETYPE_PNG => ['load' => 'imagecreatefrompng', 'save' => 'imagepng', 'quality' => 9], \IMAGETYPE_GIF => ['load' => 'imagecreatefromgif', 'save' => 'imagegif']]
Properties
$_errormessages
protected
static mixed
$_errormessages
= array(100 => 'Error in execute()', 101 => 'Error on _insert(). Code already exists', 102 => 'Error on _update(). Code already exists in other row', 201 => 'Error on _insert(). Code is empty', 202 => 'Error on _update(). Code is empty', 311 => 'Error on _insert(). Email not valid', 312 => 'Error on _insert(). Password not defined', 313 => 'Error on _update(). Passwords are different', 314 => 'Error on _update(). Password must be 5 characters or more', 315 => 'Error on _update(). Value must be between MIN and MAX values', 895 => 'No API token or API token invalid', 896 => 'API token not found', 897 => 'API token not active', 898 => 'API token invalid (too young)', self::API_TOKEN_TOO_OLD => 'API token invalid (too old)')
Methods
__()
public
static __(mixed $text) : mixed
Parameters
- $text : mixed
__construct()
public
__construct() : mixed
_add_last_slash_if_not()
public
static _add_last_slash_if_not(mixed $string) : mixed
Parameters
- $string : mixed
_add_slash_if_necessary()
public
static _add_slash_if_necessary(mixed $fileroot) : mixed
Parameters
- $fileroot : mixed
_append_to_file_static()
public
static _append_to_file_static(mixed $text) : mixed
Parameters
- $text : mixed
_bindtextdomain()
public
static _bindtextdomain([mixed $domain = self::_TEXT_DOMAIN ]) : mixed
Parameters
- $domain : mixed = self::_TEXT_DOMAIN
_build_block()
Returns a block of text, with variables, replaced
public
_build_block(string $blocktext, array<string|int, mixed> $row[, bool $clearvars = TRUE ]) : string
Parameters
- $blocktext : string
-
Text to update
- $row : array<string|int, mixed>
-
An associated array of variables
- $clearvars : bool = TRUE
-
If variables still stay in text, replace them by '' (or not)
Tags
Return values
string —The $text, updated
_build_structure_from_file()
public
static _build_structure_from_file(mixed $filepath[, mixed $pathroot = null ]) : mixed
Parameters
- $filepath : mixed
- $pathroot : mixed = null
_create_hash_if_needed()
public
static _create_hash_if_needed(mixed $structure, mixed $pathroot) : mixed
Parameters
- $structure : mixed
- $pathroot : mixed
_delete_hash_if_needed()
public
static _delete_hash_if_needed(mixed $structure, mixed $pathroot) : mixed
Parameters
- $structure : mixed
- $pathroot : mixed
_extract_extension()
public
static _extract_extension(mixed $filename) : mixed
Parameters
- $filename : mixed
_get_errormessage()
public
static _get_errormessage(mixed $error) : mixed
Parameters
- $error : mixed
_hash_filepath()
public
static _hash_filepath(mixed $filepath[, mixed $pathroot = null ]) : mixed
Parameters
- $filepath : mixed
- $pathroot : mixed = null
_switch_text_to_locale()
public
static _switch_text_to_locale(mixed $locale) : mixed
Parameters
- $locale : mixed
_translate_text()
Translate a text, by calling __()
public
static _translate_text(string $text[, string $linuxlocale = NULL ]) : string
Parameters
- $text : string
-
Text to translate
- $linuxlocale : string = NULL
-
the function setlocale needs this parameter
Tags
Return values
string —The $text translated
getGUID()
public
static getGUID() : mixed
getGUIDv2()
public
static getGUIDv2() : mixed
is_dir_empty()
public
static is_dir_empty(mixed $dir) : mixed
Parameters
- $dir : mixed
thumbnailImage()
public
static thumbnailImage(mixed $imagePath, mixed $targetWidth[, mixed $targetHeight = null ]) : mixed
Parameters
- $imagePath : mixed
- $targetWidth : mixed
- $targetHeight : mixed = null