Each of the different types of Custom Logic: Custom Events, Custom API, and Custom Validation share these common syntax and available functions.
PCR-360 Data functions
query
Execute read-only SQL query on database.
array $this->query ( string $sql, array $bind_parameters );
Parameters
$sql The query string. All data inside the query should be bound with named bind variables or properly escaped.
$bind_parameters An array of key value pairs with elements that are bound parameters in the SQL statement being executed. Array key names match the named bind variables in the SQL statement.
Return Values
Returns FALSE on failure. For successful queries, query() will return an array of data.
listGetByCode
Lookup the RECID(s) for the List determined by the type and the code(s).
mixed $this->listGetByCode ( string $list_type, mixed $list_code );
Parameters
$list_type The List Type specification of the desired record.
$list_code A string or array specifying the one or more List Codes belonging to the specified List Type. Only RECIDs for valid Codes will be returned. An array of three codes where one is invalid will return an array of two valid RECIDs.
Return Values
Returns a List RECID or array of List RECIDs if records were found. Returns NULL if nothing is found.
listFindValue
Lookup the List value for given List RECID.
string $this->listGetByCode ( int $recid );
Parameters
$recid The List Recid to find in the LISTS table.
Return Values
List Value of the specified record. Returns NULL if nothing is found.
listFindCode
Lookup the List code for given List RECID.
string $this->listGetByCode ( int $recid );
Parameters
$recid The List Recid to find in the LISTS table.
Return Values
List Code of the specified record. Returns NULL if nothing is found.
Other allowed functions & syntax
Logical Structures: if /elseif /else , switch/case/default , break , for , foreach/as , while , do-while , return
Date/Time: date , time , mktime , strtotime
Mathematical: round , ceil , floor , rand , srand , pow , exp , abs , max , min , bindec , hexdec , octdec , base_convert
String: strtolower , strtoupper , substr , stristr , strstr , stripos , strpos , strripos , strrpos , addslashes , chr , trim , ltrim , rtrim , str_replace , substr_replace , strlen
Array: explode , implode , is_array , in_array , is_numeric , json_decode
Debug: error_log
cURL: curl_init , curl_setopt , curl_exec , curl_errno , curl_error , curl_getinfo , curl_close
cURL Constants: CURLOPT_URL, CURLOPT_HEADER, CURLOPT_NOBODY, CURLOPT_HTTPGET, CURLOPT_RETURNTRANSFER
PHP Constants: NULL, TRUE, FALSE