Documentation

z_framework
in package

First class that is instantiated during a request.

Table of Contents

$action_pattern_replacement  : array<string|int, array<string|int, mixed>>
$ActionStack  : array<string|int, string>
$config  : array<string|int, mixed>
$config_file  : string
$ControllerStack  : array<string|int, string>
$dbhost  : string
$dbname  : string
$dbpassword  : string
$dbusername  : string
$host  : string
$maxReroutes  : int
$req  : Request
$reroutes  : int
$res  : Response
$root  : string
$rootFolder  : string
$settings  : array<string|int, mixed>
$showErrors  : int
$url  : string
$urlParts  : array<string|int, string>
$user  : User
$z_controllers  : string
$z_db  : z_db
$z_framework_root  : string
$z_models  : string
$z_views  : string
$conn  : mysqli
$defaultIndex  : string
$modelCache  : array<string|int, z_Model>
$rootDirectory  : string
__construct()  : mixed
Parses all the options as variables, instantiates the z_db, and establishes the db connection.
execute()  : mixed
Executes the requested action
executePath()  : mixed
Executes an action for a specified path
getModel()  : z_model
Returns a model
getViewPath()  : string
Returns the path of a view. If the view does not exist, this function will fall back to the framework defaults.
updateErrorHandling()  : mixed
Updates the error handling state
decodePost()  : mixed
Decodes all data sent via POST. Decoding method can be determined by the prefix of the value.
parseUrl()  : mixed
Used to parse the URL into parts and parameters Format: root/class/method/parameter/parameter/.
rest()  : mixed
Answers this request with a REST

Properties

$action_pattern_replacement

public array<string|int, array<string|int, mixed>> $action_pattern_replacement = [["-", "_"], [".", "§2E"], ["ä", "ae"], ["ö", "oe"], ["ü", "ue"]]

Replacement patterns for action names

$ActionStack

public array<string|int, string> $ActionStack = []

All visited actions as an array

$config

public array<string|int, mixed> $config = []

An associative array of key-value config parameters

$config_file

public string $config_file = "z_config/z_settings.ini"

Path to the config file

$ControllerStack

public array<string|int, string> $ControllerStack = []

All visited controllers as an array

$dbhost

public string $dbhost

Hostname of the machine on which the database resides

$dbname

public string $dbname

Name of the database

$dbpassword

public string $dbpassword

Password for the database connection

$dbusername

public string $dbusername

Username for the database connection

$host

public string $host

Name of the host of this page

$maxReroutes

public int $maxReroutes = 10

Number of reroutes the controller can perform before aborting

$req

public Request $req

A reference to an instance of the Request class

$reroutes

public int $reroutes = 0

Number of times this request was rerouted

$res

public Response $res

A reference to an instance of the Response class

$root

public string $root

Absolute path to the page

$rootFolder

public string $rootFolder

Path to the root folder

$settings

public array<string|int, mixed> $settings

Stores the z_framework settings

$showErrors

public int $showErrors

Defines what errors should be shown

$url

public string $url

URL to reach this page

$urlParts

public array<string|int, string> $urlParts

Exploded URL

$z_controllers

public string $z_controllers = "z_controllers/"

Directory in which the controllers live

$z_db

public z_db $z_db

Database proxy object

$z_framework_root

public string $z_framework_root = "z_framework/"

Directory where the framework files live

$z_models

public string $z_models = "z_models/"

Directory in which the models live

$z_views

public string $z_views = "z_views/"

Directory of the views

$conn

private mysqli $conn

Database connection object

$defaultIndex

private string $defaultIndex

Name of the controller when none is specifically selected

$modelCache

private array<string|int, z_Model> $modelCache = []

Stores all already used models for this request

$rootDirectory

private string $rootDirectory

Path to the root directory

Methods

__construct()

Parses all the options as variables, instantiates the z_db, and establishes the db connection.

public __construct([mixed $params = [] ]) : mixed
Parameters
$params : mixed = []
Return values
mixed

execute()

Executes the requested action

public execute([array<string|int, mixed>|null $customUrlParts = null ]) : mixed
Parameters
$customUrlParts : array<string|int, mixed>|null = null

Example: ["panel", "index"]

Return values
mixed

executePath()

Executes an action for a specified path

public executePath(array<string|int, mixed> $parts) : mixed
Parameters
$parts : array<string|int, mixed>

Example: ["auth", "login"]

Return values
mixed

getModel()

Returns a model

public getModel(string $model[, string $dir = null ]) : z_model
Parameters
$model : string

Name of the model

$dir : string = null

Set this when the model is stored in a specific directory

Return values
z_model

The model

getViewPath()

Returns the path of a view. If the view does not exist, this function will fall back to the framework defaults.

public getViewPath(mixed ...$documents) : string
Parameters
$documents : mixed
Return values
string

Relative path to the view file

updateErrorHandling()

Updates the error handling state

public updateErrorHandling([int|null $state = null ]) : mixed
Parameters
$state : int|null = null
Return values
mixed

decodePost()

Decodes all data sent via POST. Decoding method can be determined by the prefix of the value.

private decodePost() : mixed
Return values
mixed

parseUrl()

Used to parse the URL into parts and parameters Format: root/class/method/parameter/parameter/.

private parseUrl() : mixed

..

Return values
mixed

rest()

Answers this request with a REST

private rest(mixed $options) : mixed
Parameters
$options : mixed
Return values
mixed

Search results