Galette API documentation
Gestionnaire d’Adhérents en Ligne Extrêmement Tarabiscoté mais Tellement Efficace
1.0.0
Galette\IO Namespace Reference

Classes

class  Charts
 
class  ContributionsCsv
 
class  Csv
 
class  CsvIn
 
class  CsvOut
 
class  ExternalScript
 
class  File
 
interface  FileInterface
 
class  MembersCsv
 
class  News
 
class  Pdf
 
class  PdfAdhesionForm
 
class  PdfAttendanceSheet
 
class  PdfContribution
 
class  PdfGroups
 
class  PdfMembersCards
 
class  PdfMembersLabels
 
class  ScheduledPaymentsCsv
 

Functions

 init (string|null $dest=null, array $extensions=null, array $mimes=null, int $maxlenght=null, int $mincropsize=null)
 
 copyTo (string $dest)
 
 store (array $file, bool $ajax=false)
 
 buildDestPath ()
 
 writeOnDisk (string $tmpfile, bool $ajax)
 
 getDestDir ()
 
 setDestDir (string $dir)
 
 getFileName ()
 
 setFileName (string $name)
 
 getBadChars ()
 
 getAllowedExts ()
 
 getAllowedMimeTypes ()
 
 getErrorMessageFromCode (int $code)
 
 getErrorMessage (int $code)
 
 getPhpErrorMessage (int $error_code)
 

Variables

trait FileTrait
 
string $name
 
string $name_wo_ext
 
string $extension
 
string $dest_dir
 
array $allowed_extensions = array()
 
array $allowed_mimes = array()
 
int $maxlenght
 
int $mincropsize
 

Detailed Description

Copyright © 2003-2024 The Galette Team

This file is part of Galette (https://galette.eu).

Galette is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Galette is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Galette. If not, see http://www.gnu.org/licenses/.

Function Documentation

◆ buildDestPath()

Galette\IO\buildDestPath ( )
protected

Build destination path

Returns
string

◆ copyTo()

Galette\IO\copyTo ( string  $dest)

Copy existing file to new Location

Parameters
string$destDestination directory
Returns
boolean

◆ getAllowedExts()

Galette\IO\getAllowedExts ( )

Returns allowed extensions

Returns
string comma separated allowed extensions

◆ getAllowedMimeTypes()

Galette\IO\getAllowedMimeTypes ( )

Return the array of allowed mime types

Returns
array<string,string>

◆ getBadChars()

Galette\IO\getBadChars ( )

Returns unauthorized characters literal values quoted, comma separated values

Returns
string comma separated disallowed characters

◆ getDestDir()

Galette\IO\getDestDir ( )

Get destination dir

Returns
?string

◆ getErrorMessage()

Galette\IO\getErrorMessage ( int  $code)

Return textual error message

Parameters
int$codeThe error code
Returns
string Localized message

◆ getErrorMessageFromCode()

Galette\IO\getErrorMessageFromCode ( int  $code)
protected

Return textual error message

Parameters
int$codeThe error code
Returns
string Localized message

FIXME: should be more descriptive

◆ getFileName()

Galette\IO\getFileName ( )

Get file name

Returns
?string

◆ getPhpErrorMessage()

Galette\IO\getPhpErrorMessage ( int  $error_code)

Return textual error message send by PHP after upload attempt

Parameters
int$error_codeThe error code
Returns
string Localized message

◆ init()

Galette\IO\init ( string|null  $dest = null,
array  $extensions = null,
array  $mimes = null,
int  $maxlenght = null,
int  $mincropsize = null 
)
protected

Initialization

Parameters
?string$dest File destination directory
?array<int,string>$extensions Array of permitted extensions
?array<string,string>$mimes Array of permitted mime types
?int$maxlenght Maximum length for each file
?int$mincropsize Minimum image side size required for cropping
Returns
void

◆ setDestDir()

Galette\IO\setDestDir ( string  $dir)

Set destination directory

Parameters
string$dirDirectory
Returns
void

◆ setFileName()

Galette\IO\setFileName ( string  $name)

Set file name

Parameters
string$namefile name
Returns
void

◆ store()

Galette\IO\store ( array  $file,
bool  $ajax = false 
)

Stores a file on the disk

Parameters
array<string,string|int>$file the uploaded file
boolean$ajaxIf the file comes from an ajax call (dnd)
Returns
bool|int result of the storage process

◆ writeOnDisk()

Galette\IO\writeOnDisk ( string  $tmpfile,
bool  $ajax 
)

Write file on disk

Parameters
string$tmpfileTemporary file
bool$ajaxIf the file comes from an ajax call (dnd)
Returns
bool|int

Variable Documentation

◆ FileTrait

trait Galette::IO\FileTrait
Initial value:
{
protected array $bad_chars = array(
'.' => '\.',
'\\' => '\\\\',
"'" => "'",
' ' => ' ',
'/' => '\/',
':' => ':',
'*' => '\*',
'?' => '\?',
'"' => '"',
'<' => '<',
'>' => '>',
'|' => '|'
)

Files

Author
Johan Cwiklinski johan.nosp@m.@x-t.nosp@m.nd.be