
New functions in Plugin version 1.7.0
On this page, we document the additions to the ACF language presented in the current release or pre-release of the plugin available on our download area.
The page will be updated with new functions as soon as they are released.
Current version: 1.7.6.4
ACF-Language Built-in Function Reference for new plugin functions.
HTTP_GET
- Description: Performs a GET request to the specified HTTP or HTTPS URL.
- Prototype:
string HTTP_GET(string url, string extraheaders, string authentication_header) - Parameters:
url: The URL for the HTTP GET request.extraheaders(optional): Multiline string with one header per line for additional request headers.authentication_header(optional): Header for authentication.
- Return value: The text returned from the request or an error message.
HTTP_POST
- Description: Performs a POST request to the specified URL with provided data.
- Prototype:
string HTTP_POST(string url, string postData, string extraheaders, string authentication_header) - Parameters:
url: The URL for the HTTP POST request. May use both http or https URLspostData: Data to be sent in the POST request.extraheaders(optional): Additional headers for the request.authentication_header(optional): Header for authentication.
- Return value: The text returned from the request or an error message.
HTTP_PATCH, HTTP_PUT, HTTP_DELETE
- Using the same parameters as HTTP_POST, but different method. Some API functions require those methods for their API call.
http_basic_auth
- Description: Creates a basic authentication header, for use in HTTP_GET and HTTP_POST.
- Prototype:
string http_basic_auth(string user, string password) - Parameters:
user: Username for authentication.password: Password for authentication.
- Return value: Authentication header for use in HTTP_GET and HTTP_POST.
base64_encode
- Description: Encodes text or binary data to Base64.
- Prototype:
string base64_encode(string TextOrBinaryToEncode, int options) - Parameters:
TextOrBinaryToEncode: The text or binary data to encode.options(optional): Encoding options (0=default, 1=without line separators, 2=Base64URL with line separators, 3=Base64URL without line separators).
- Return value: string as base64 encoded text.
base64_decode
- Description: Decodes Base64 encoded text.
- Prototype:
string base64_decode(string base64_encoded_text) - Parameters:
base64_encoded_text: The Base64 encoded text to decode.
- Return value: Decoded text or binary as a string.
base32_encode
- Description: Encodes text or binary data to Base32.
- Prototype:
string base32_encode(string TextOrBinaryToEncode) - Parameters:
TextOrBinaryToEncode: The text or binary data to encode.
- Return value: string as base32 encoded text.
base32_decode
- Description: Decodes Base32 encoded text.
- Prototype:
string base32_decode(string EncodedText) - Parameters:
EncodedText: The Base32 encoded text to decode.
- Return value: Decoded text or binary as a string.
confirm
- Description: Displays a confirmation dialog with a message.
- Prototype:
bool confirm(string message, string YesButtonText, string NoButtonText) - Parameters:
message: The message to display in the dialog.YesButtonText(optional): Text for the 'Yes' button.NoButtonText(optional): Text for the 'No' button.
- Return value: bool true or false, Yes button = true, No button = false.
request
- Description: Displays a request dialog with a message and input field.
- Prototype:
string request(string message, string defaultValue, string OKButton, string cancelButton) - Parameters:
message: Message to display in the dialog.defaultValue(optional): Default value in the input field.OKButton(optional): Text for the 'OK' button.cancelButton(optional): Text for the 'Cancel' button.
- Return value: The user-supplied text or the defaultValue if only OK is pressed. If cancel is pressed, returns an empty string.
ALERT
- Description: Displays an alert dialog with a message and a single OK button.
- Prototype:
ALERT ( string message ) - Parameters:
message: Message to display in the dialog.
- Return value: None, Use alert as a command.
generate_otp_secret
- Description: Generates a random 160-bit OTP secret as BASE32 encoded text.
- Prototype:
string generate_otp_secret() - Return value: The OTP secret.
check_otp_code
- Description: Verifies a 6-digit OTP code.
- Prototype:
bool check_otp_code(string secret, string UserSuppliedOTPcode, int windowSize) - Parameters:
secret: The secret for OTP generation.UserSuppliedOTPcode: The user-supplied OTP code to verify.windowSize(optional): Window size for time slots validation. 1 gives the previous slot, the current slot, and next slot. 2 gives two previous slots, the current and the two next slots.
- Return value: true or false whether correct or wrong user-supplied code.
get_otp_code
- Description: Retrieves the current OTP code from a secret.
- Prototype:
string get_otp_code(string secret) - Parameters:
secret: The secret for OTP generation.
- Return value: The code as a string.
New Language Elements
TRY/CATCH/TRY AGAIN/END CATCH
- Provides structured exception handling in user code.
TRY: Starts a block of code where exceptions are handled.CATCH: Catches exceptions thrown in the TRY block.TRY AGAIN: Optionally retries the TRY block.END TRY: Ends a catch block.
LAST_ERROR
- A system variable
LAST_ERRORis available within a CATCH block that contains the last error message.
