cache
Class allows saving data to cache and later use of it. Both caching in static files and databases tables is managed here.To manage cache from static files we have:
- fileRead($bucket,$key) - reads data
- fileWrite($bucket,$key,$data) - saves data
- fileIsCached($bucket,$key) - chcecks if data was saved in cache
- fileClearByBucket($bucket) - clears cache from given bucket
- read($name) - reads data
- write($name,$data,$bucket = 0) - saves data
- isCached($name,$expire = null) - checks if data was saved in cache
- clearBucket($bucket) - clears whole bucket
- clearByName($name) - clears given variable
- clearAll() - clears all variables
Variables which take functions are accordingly
- $bucket - groups of cached variables, thanks to it we can clear chosen parts of cache.
- $key oraz $name - key is a name of variable after which we will read cache
- $data - data can be in form of a table and string, system will make data into propper form
- $expire - time after variable expires in seconds
Examples of use
if (!cache::isCached('keyName')) { cache::write('keyName','our data','bucket'); } echo cache::read('keyName');
compress
Class is used to compress files into ZIP format, also allows their decompression.Main methods which can be used are:
- zip($source, $destination) - packs files
- unzip($source, $destination, $entries = '') - unpacks files
- getZipFile($fileName,$source) - returns packed files in form that begins download of the file
- $source - source file or folder
- $destination - target file to which data has to be packed
- $fileName - file name
Example of use:
compress::getZipFile('fileName.zip','./path_to_folder/')
config
This class is used for reading and adding variables to the Windu configMain methods which we can use:
- get($name,$force = false) - loads variable from config
- set($name,$value,$bucket=null,$type=null) - saves variable
- $name - name of variable in config
- $value - value of variable
- $bucket - bucket for group of variables
- $type - type of variable (numeric,bool,string)
config::set('nameOfVariable',123,'numbers','numeric'); echo config::get('variableName');
cookie
Main methotds that we can use:- get($name) - loades cookie
- setCookie($name, $value = null, $expire = 3600,$subdirForce = null) - Cookies settings
- removeCookie($name) - deletes cookie
- $name - Variables name
- $value - Variables value
- $expire - time after which variable expires, displayed in seconds
Example of use
cookie::set('variablesName',123,'numbers','numeric'); echo cookie::get('variablesName');
csv
Main methods which we can use
- rowsToCsv(array &$fields,$delimiter = ';', $enclosure = '"', $encloseAll = false, $nullToMysqlNull = false ) - returns string in form of csv file code
- getCsvFile($fileName,array &$fields, $delimiter = ';', $enclosure = '"', $encloseAll = false, $nullToMysqlNull = false ) - returns file in csv format from table
- $fileName - file name
- $fields - table with data
Example of use
csv::getCsvFile('fileName.csv',$arrayWithData);
generate
Main methods which we can use- sqlDatetime($timestemp = null) - returns datetime in sql format
- sqlDate($timestemp = null) - returns date in sql format
- showDatatime($datatime, $addDecorators = true, $onlyStringShow = false) - returns datatime with decorators
- showDate($datatime) - returns date with decorators
- ip() - returns callers IP
- randomCode($length=8,$level=3) - returns random code with set parameters
- ekey($table,$colum = 'ekey',$length=12,$level=2) - returns unique random code for given table
- urlKey($baseString,$table,$colum = 'urlKey',$length=50) - returns unique link element consistent with standarts
- replaceChars($data) - switching polish signs
- clean($data) - clears string from forbiden signs
- cleanFileName($data) - prepares name of the file
- clearHtml($data) - cleans html
- clearHtmlNl2Br($data) - cleans html and changes new lines for br markers
- $timestemp - so called timestemp in the form of a number
- $datatime - date in the form of datatime mysql
- $data - data in form of a string
validator
Main validators which we can use- email($value, $params = null, &$data)
- url($value, $params = null, &$data)
- stringLength($value,$params, &$data)
- numericLength($value,$params,&$data)
- numeric($value,$params,&$data)
- bool($value,$params,&$data)
- string($value,$params,&$data)
- unique($value,$params,&$data,$fieldName)
- exist($value,$params,&$data,$fieldName)
- same($value,$params,&$data)
- fileSize($value,$params,&$data,$fieldName)
- datatime($value,$params,&$data)
- fileType($value,$params,&$data,$fieldName)
- $value - value
- $params - validators parameters in form of a table
- $data - optional data
- $fieldName - name of a cell in table