Zed. The source code to build a world.

Actions
in package

Actions class

Each method is called by first part of your URL, other parts are arguments e.g. /do.php/validate_quux_request/52 = Actions::validate_quux_request(52);

You can also use $_GET, $_POST or better $_REQUEST.

Don't print the value but return it, so we can in the future implement custom formats like api_output();

Table of Contents

Properties

$CurrentPerso  : Perso
$CurrentUser  : User
$db  : DatabaseEngine

Methods

get_content()  : array<string|int, mixed>
Gets multimedia content for the specified location
global_move()  : Location
Moves the current perso's, setting a new global and local location.
local_move()  : Location
Moves the current perso's, setting a new local location.
perso_request()  : bool
Handles a allow/deny perso request.
polarz_local_move()  : Location
Moves the current perso's, setting a new local location, using polar+z coordinates.
set_local_location()  : Location
Sets current perso's local location.
upload_content()  : string
Handles upload content form.
is_hash_valid()  : bool
Checks the arguments hash and determines whether it is valid.

Properties

$CurrentPerso

public Perso $CurrentPerso

$CurrentUser

public User $CurrentUser

$db

public DatabaseEngine $db

Methods

get_content()

Gets multimedia content for the specified location

public get_content(string $location_global) : array<string|int, mixed>
Parameters
$location_global : string

The global location (local is to specified in ?location_local parameter)

Return values
array<string|int, mixed>

an array of Content instances

global_move()

Moves the current perso's, setting a new global and local location.

public global_move(string $location_global[, string $location_local = null ]) : Location
Parameters
$location_global : string

The global location

$location_local : string = null

The local location

Return values
Location

the current perso's Location object

local_move()

Moves the current perso's, setting a new local location.

public local_move(string $move[, int $factor = 1 ]) : Location

We don't require a security hash. If the users want to play with it, no problem. You generally move inside a global location as you wish. So, if you write a story capturing a perso, use flags to handle this escape!

Parameters
$move : string

the move (coordinates or direction)

$factor : int = 1

a number multiplying the specified move [optional]

Return values
Location

the current perso's Location object

e.g. to move from 2 units to east, you can use one of those instructions: local_move('east', 2); local_move('2,0,0'); local_move('1,0,0', 2);

Valid moves string are north, east, south, west, up and down. Valid moves coordinates are x,y,z (3 integers, comma as separator)

perso_request()

Handles a allow/deny perso request.

public perso_request(string $request_flag, string $store, string $key, string $value, string $hash) : bool
Parameters
$request_flag : string

the request flag to clear

$store : string

'perso' or 'registry'

$key : string

the perso flag or registry key

$value : string

the value to store

$hash : string

the security hash

Return values
bool

true if the request is valid and have been processed ; otherwise, false.

polarz_local_move()

Moves the current perso's, setting a new local location, using polar+z coordinates.

public polarz_local_move(string $move[, int $factor = 1 ]) : Location

Polar+z coordinates are polar coordinates, plus a cartesian z dimension.

We don't require a security hash. If the users want to play with it, no problem. You generally move inside a global location as you wish. So, if you write a story capturing a perso, use flags to handle this escape!

Parameters
$move : string

the move (coordinates or direction)

$factor : int = 1

a number multiplying the specified move [optional]

Return values
Location

the current perso's Location object

Valid moves string are cw, ccw, out, in, up and down. r: out = +12 in = -12 °: cw = +20° ccw = -20 Valid moves coordinates are r,°,z (3 integers, comma as separator) (the medium value can also be integer + °)

e.g. to move of two units (the unit is 20°) clockwise: polarz_local_move('cw', 2); polarz_local_move('(0, 20°, 0)', 2); polarz_local_move('(0, 40°, 0)'); Or if you really want to use radians (PI/9 won't be parsed): polarz_local_move('(0, 0.6981317007977318, 0)';

set_local_location()

Sets current perso's local location.

public set_local_location(string $location_local) : Location

We don't require a security hash. If the users want to play with it, no problem. You generally move inside a global location as you wish. So, if you write a story capturing a perso, use flags to handle this escape!

Parameters
$location_local : string

the local location

Return values
Location

the current perso's Location object

upload_content()

Handles upload content form.

public upload_content() : string
Return values
string

new content path

is_hash_valid()

Checks the arguments hash and determines whether it is valid.

private static is_hash_valid(array<string|int, mixed> $args) : bool
Parameters
$args : array<string|int, mixed>

the arguments, the last being the hash

Return values
bool

true if the hash is valid ; otherwise, false.


        
On this page

Search results