TouchPointWP_AdminAPI
in package
implements
api
Admin API class.
Table of Contents
Interfaces
- api
- API Interface
Constants
- API_ENDPOINT_SCRIPTZIP = "scriptzip"
Methods
- __construct() : mixed
- Constructor function
- api() : bool
- Handle API requests
- displayField() : string
- Generate HTML for displaying fields.
- generatePython() : string|array<string|int, mixed>
- Generate the python scripts to be uploaded to TouchPoint.
- showError() : mixed
- Display an error when there's something wrong with the TouchPoint connection.
Constants
API_ENDPOINT_SCRIPTZIP
public
mixed
API_ENDPOINT_SCRIPTZIP
= "scriptzip"
Methods
__construct()
Constructor function
public
__construct() : mixed
api()
Handle API requests
public
static api(array<string|int, mixed> $uri) : bool
Parameters
- $uri : array<string|int, mixed>
-
The request URI already parsed by parse_url()
Return values
bool —False if endpoint is not found. Should print the result.
displayField()
Generate HTML for displaying fields.
public
displayField([array<string|int, mixed> $data = [] ][, WP_Post|null $post = null ][, bool $echo = true ]) : string
Parameters
- $data : array<string|int, mixed> = []
-
Data array.
- $post : WP_Post|null = null
-
Post object.
- $echo : bool = true
-
Whether to echo the field HTML or return it.
Return values
stringgeneratePython()
Generate the python scripts to be uploaded to TouchPoint.
public
generatePython(bool $toZip[, array<string|int, mixed> $filenames = ['*'] ]) : string|array<string|int, mixed>
Parameters
- $toZip : bool
-
Set true to combine into a Zip file.
- $filenames : array<string|int, mixed> = ['*']
-
Indicate which files should be included, based on their repo name. Add '*' to the array to include all files regardless of name.
Tags
Return values
string|array<string|int, mixed> —If toZip is true, returns the file path of the zip file. If toZip is false, returns an array of filename => content.
showError()
Display an error when there's something wrong with the TouchPoint connection.
public
static showError(mixed $message) : mixed
Parameters
- $message : mixed