AJAX
class AJAX extends IOInterface
The interface for using Andromeda over a web server
Constants
| OUTPUT_PLAIN |
|
| OUTPUT_JSON |
|
| OUTPUT_PRINTR |
|
Properties
| static private | $instances | from Singleton | |
| protected Input[] | $inputs | from IOInterface | |
| protected | $outmode | from IOInterface | |
| private | $retfuncs | from IOInterface | |
| private | $numretfuncs | from IOInterface |
Methods
Constructs and returns a singleton of the appropriate interface type
Returns whether or not the interface is in use for this request
No description
Called during API construction to initialize the interface, e.g. to gather global arguments
Retrieves an array of input objects from the request to run
Returns the address of the user on the interface
Returns the user agent string on the interface
Returns the path to the DB config file requested by the interface
No description
Sets the output mode to the given mode or null (none) - NOT USED in "multi-output" mode!
Registers a user output handler function to run after the initial commit
Returns the binary-packed version of the given integer size
Fetches an input object from the HTTP request
Helper function to send an HTTP post request
Details
in
IOInterface at line 97
__construct()
Construct the singleton for use.
This can be overriden if it requires more arguments
in
IOInterface at line 36
static IOInterface|null
TryGet()
Constructs and returns a singleton of the appropriate interface type
at line 33
static bool
isApplicable()
Returns whether or not the interface is in use for this request
at line 39
static bool
isPrivileged()
No description
in
IOInterface at line 50
void
Initialize()
Called during API construction to initialize the interface, e.g. to gather global arguments
in
IOInterface at line 59
array
GetInputs(Config|null $config)
Retrieves an array of input objects to run
at line 60
protected array
subGetInputs(Config|null $config)
Retrieves an array of input objects from the request to run
Requests can put multiple requests to be run in a single transaction by using the batch paramter as an array
in
IOInterface at line 69
void
DisallowBatch()
Asserts that only one output was given
at line 41
string
getAddress()
Returns the address of the user on the interface
at line 46
string
getUserAgent()
Returns the user agent string on the interface
in
IOInterface at line 82
int
GetDebugLevel()
Returns the debugging level requested by the interface
in
IOInterface at line 85
int
GetMetricsLevel()
Returns the perf metrics level requested by the interface
in
IOInterface at line 88
string|null
GetDBConfigFile()
Returns the path to the DB config file requested by the interface
at line 52
static int
GetDefaultOutmode()
No description
in
IOInterface at line 100
IOInterface
SetOutputMode(int|null $mode)
Sets the output mode to the given mode or null (none) - NOT USED in "multi-output" mode!
in
IOInterface at line 112
IOInterface
RegisterOutputHandler(OutputHandler $f)
Registers a user output handler function to run after the initial commit
Sets the output mode to null if bytes !== null and will cause "multi-output" mode to be used if > 1 functions that return > 0 bytes are defined
in
IOInterface at line 135
protected bool
isMultiOutput()
Returns true if the output is using multi-output mode
Multi-output mode is used when more than one user output function wants to run. To accomodate this, each section will be prefaced with the number of bytes written. In multi-output mode, the requested global output mode is ignored and the request is always finished with JSON output (also with the # of bytes prefixed)
in
IOInterface at line 142
static protected string
formatSize(int $size)
Returns the binary-packed version of the given integer size
unsigned long long (always 64 bit, big-endian byte order)
at line 137
bool
UserOutput(Output $output)
Tells the interface to run the custom user output functions
at line 151
WriteOutput(Output $output)
Tells the interface to print its final output
at line 99
private Input
GetInput(array $get, array $files, array $request)
Fetches an input object from the HTTP request
App and Action must be part of $_GET, everything else can be interchangeably in $_GET or $POST - except 'password' and 'auth' which cannot be in $_GET
at line 216
static string
GetRemoteURL(string $url, Input $input, bool $params = true)
Build a remote Andromeda request URL
at line 230
static array
RemoteRequest(string $url, Input $input)
Send a request to a remote Andromeda API
at line 247
static string|null
HTTPPost(string $url, array $post)
Helper function to send an HTTP post request