Documentation

util.php

Table of Contents

Functions

escapeSQLString()  : string
escape apostrophe in SQL
safe_key()  : string
Safe key name from string
t()  : string
translate string with format main.key
c()  : object
create object through DI Container
m()  : BaseModel
Create model class instance using a dependency injection container.
pagination()  : array<string|int, mixed>
Pagination with elipsis.
create_ini()  : string
Create .ini file string from array (compatible with F3 config).
csrf()  : void
Set CSRF into session and return its value.
cache()  : mixed
Retrieves data from cache if available, otherwise processes and caches it for a specified duration.
al()  : array<string|int, mixed>
Membuat daftar field alias untuk rakitval.
buildTree()  : void
Build tree from flat array
isLoggedIn()  : bool
Is user logged in for this app id?
rbac_permission()  : bool
Check user permissions based on their group, section, and path, with additional checks for superadmin privileges.
rbac_session_permission()  : bool
Checks if a user has permission to access a specific section or resource path based on their session credentials.
rbac_path_permission()  : mixed
guidv4()  : string
Generates a version 4 UUID in PHP using random bytes.

Functions

escapeSQLString()

escape apostrophe in SQL

escapeSQLString(string $str) : string
Parameters
$str : string
Return values
string

safe_key()

Safe key name from string

safe_key(string $key) : string
Parameters
$key : string
Return values
string

t()

translate string with format main.key

t() : string
Return values
string

c()

create object through DI Container

c(string $class[, array<string|int, mixed> $params = [] ]) : object
Parameters
$class : string
$params : array<string|int, mixed> = []
Return values
object

m()

Create model class instance using a dependency injection container.

m(string $class) : BaseModel
Parameters
$class : string
Return values
BaseModel

pagination()

Pagination with elipsis.

pagination(int $c, int $m[, int $d = 5 ]) : array<string|int, mixed>
Parameters
$c : int

current page

$m : int

total pages

$d : int = 5

radius

Return values
array<string|int, mixed>

create_ini()

Create .ini file string from array (compatible with F3 config).

create_ini(array<string|int, mixed> $vals) : string
Parameters
$vals : array<string|int, mixed>
Return values
string

csrf()

Set CSRF into session and return its value.

csrf() : void

cache()

Retrieves data from cache if available, otherwise processes and caches it for a specified duration.

cache(string $key[, int $duration = 84600 ][, callable|null $process = null ]) : mixed
Parameters
$key : string
$duration : int = 84600
$process : callable|null = null

al()

Membuat daftar field alias untuk rakitval.

al(string $section, string|array<string|int, mixed> $fields) : array<string|int, mixed>
Parameters
$section : string
$fields : string|array<string|int, mixed>
Return values
array<string|int, mixed>

buildTree()

Build tree from flat array

buildTree(array<string|int, mixed> &$elements[, int $parentId = 0 ]) : void
Parameters
$elements : array<string|int, mixed>
$parentId : int = 0

isLoggedIn()

Is user logged in for this app id?

isLoggedIn() : bool
Return values
bool

rbac_permission()

Check user permissions based on their group, section, and path, with additional checks for superadmin privileges.

rbac_permission(mixed $user, mixed $group, mixed $permissions[, mixed $section = "" ][, mixed $rpath = "" ]) : bool
Parameters
$user : mixed
$group : mixed
$permissions : mixed
$section : mixed = ""
$rpath : mixed = ""
Return values
bool

The function rbac_permission returns a boolean value.

rbac_session_permission()

Checks if a user has permission to access a specific section or resource path based on their session credentials.

rbac_session_permission([mixed $section = "" ][, mixed $rpath = "" ]) : bool
Parameters
$section : mixed = ""
$rpath : mixed = ""
Return values
bool

rbac_path_permission()

rbac_path_permission(mixed $path) : mixed
Parameters
$path : mixed

guidv4()

Generates a version 4 UUID in PHP using random bytes.

guidv4() : string
Return values
string

a 36-character UUID string in the format xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx, where each x is a hexadecimal digit and y is a hexadecimal digit with the most significant bits set to 10.


        
On this page

Search results