Skip to main content

GFWebAPI

Source: includes/webapi/webapi.php:27

Details

  • Kind: class
  • Namespace: (global)
  • Extends: GFAddOn

Methods

MethodDescription
get_instance()Returns the current instance of this class.
post_gravityforms_upgrade()Triggers the db upgrade following an install, version update, or when forced from the system status page.
maybe_upgrade_schema()Updates REST API related schema when GF version changes
requires_schema_upgrade()Returns true if REST API schema needs to be upgraded. False otherwise.
is_api_enabled()Determines if the API is enabled in the database.
init_admin()Adds admin hooks.
output_webapi_json()Echo json containing webapi variables for use in the handle unsaved changes function
get_menu_icon()Return the plugin's icon for the plugin/form settings menu.
plugin_settings_page()Plugin Settings page.
get_users()Get users for the user select field in the API key settings
user_can_access_api()Checks if a user has one or more capabilities to access Gravity Forms REST API endpoints.
settings_webapi_user_select()Output the user select field for impersonating an account when using the API key.
set_logging_supported()Removes the REST API from the logging page.
log_error()Write an error message to the Gravity Forms API log.
log_debug()Write a debug message to the Gravity Forms API log.
ajax_delete_key()Deletes a REST API key from an AJAX request.
ajax_edit_key()Handle edit key related AJAX requests.
mtd_transform_entries_data()Support for MonoTouch.Dialog
rand_hash()Generate a rand hash.
api_hash()Hashes specified text.

Method Reference

get_instance()

public static function get_instance()

Returns the current instance of this class.

Returns

Since: 2.4.24

Source: includes/webapi/webapi.php:66

post_gravityforms_upgrade()

public function post_gravityforms_upgrade( $db_version, $previous_db_version, $force_upgrade )

Triggers the db upgrade following an install, version update, or when forced from the system status page.

Parameters

NameTypeDefaultDescription
$db_versionstringCurrent Gravity Forms database version.
$previous_db_versionstringPrevious Gravity Forms database version.
$force_upgradeboolTrue if this is a request to force an upgrade. False if this is a standard upgrade (due to version change).

Since: 2.4.24

Source: includes/webapi/webapi.php:116

maybe_upgrade_schema()

public function maybe_upgrade_schema( $force_upgrade=false )

Updates REST API related schema when GF version changes

Parameters

NameTypeDefaultDescription
$force_upgradeboolfalseTrue if this is a request to force an upgrade. False if this is a standard upgrade (due to version change).

Since:

  • 2.4
  • 2.4.24 (Added the $force_upgrade param.)

Source: includes/webapi/webapi.php:128

requires_schema_upgrade()

public function requires_schema_upgrade()

Returns true if REST API schema needs to be upgraded. False otherwise.

Returns

  • bool

Since: 2.4-beta-1

Source: includes/webapi/webapi.php:165

is_api_enabled()

public function is_api_enabled()

Determines if the API is enabled in the database.

Returns

  • boolean — True if the API is enabled, false otherwise.

Since: 2.4.23

Source: includes/webapi/webapi.php:206

init_admin()

public function init_admin()

Adds admin hooks.

Since:

  • unknown
  • 2.4.18 (Removed caps integrations to prevent them being added to the Add-Ons group.)

Source: includes/webapi/webapi.php:218

output_webapi_json()

public function output_webapi_json()

Echo json containing webapi variables for use in the handle unsaved changes function

Since: 2.5

Source: includes/webapi/webapi.php:337

get_menu_icon()

public function get_menu_icon()

Return the plugin's icon for the plugin/form settings menu.

Returns

  • string

Since: 2.5

Source: includes/webapi/webapi.php:359

plugin_settings_page()

public function plugin_settings_page()

Plugin Settings page.

Since: 2.5

Source: includes/webapi/webapi.php:372

get_users()

public static function get_users( $args=[], $search='' )

Get users for the user select field in the API key settings

Parameters

NameTypeDefaultDescription
$argsarray[]
$searchstring''

Returns

  • array

Source: includes/webapi/webapi.php:484

user_can_access_api()

public static function user_can_access_api( $user )

Checks if a user has one or more capabilities to access Gravity Forms REST API endpoints.

Parameters

NameTypeDefaultDescription
$userWP_UserWP User object.

Returns

  • bool

Since: 2.4.24

Source: includes/webapi/webapi.php:532

settings_webapi_user_select()

public function settings_webapi_user_select()

Output the user select field for impersonating an account when using the API key.

Returns

  • void

Since: next

Source: includes/webapi/webapi.php:763

set_logging_supported()

public function set_logging_supported( $plugins )

Removes the REST API from the logging page.

Parameters

NameTypeDefaultDescription
$pluginsarrayThe plugins which support logging.

Returns

  • array

Since: 2.4.11

Source: includes/webapi/webapi.php:791

log_error()

public function log_error( $message )

Write an error message to the Gravity Forms API log.

Parameters

NameTypeDefaultDescription
$messagestringThe message to be logged.

Since: 2.4.11

Source: includes/webapi/webapi.php:802

log_debug()

public function log_debug( $message )

Write a debug message to the Gravity Forms API log.

Parameters

NameTypeDefaultDescription
$messagestringThe message to be logged.

Since: 2.4.11

Source: includes/webapi/webapi.php:813

ajax_delete_key()

public function ajax_delete_key()

Deletes a REST API key from an AJAX request.

Since: Unknown

Source: includes/webapi/webapi.php:1113

ajax_edit_key()

public function ajax_edit_key()

Handle edit key related AJAX requests.

Since: 2.5

Source: includes/webapi/webapi.php:1134

mtd_transform_entries_data()

public function mtd_transform_entries_data( $output, $form_id )

Support for MonoTouch.Dialog

Parameters

NameTypeDefaultDescription
$output
$form_id

Source: includes/webapi/webapi.php:2535

rand_hash()

public function rand_hash()

Generate a rand hash.

Returns

  • string

Since:

  • 2.4-beta-1
  • 2.5 (add a fallback generation method in case openssl_random_pseudo_bytes() returns empty.)

Source: includes/webapi/webapi.php:2639

api_hash()

public static function api_hash( $data )

Hashes specified text.

Parameters

NameTypeDefaultDescription
$datastringMessage to be hashed.

Returns

  • string — Hashed data

Since: 2.4-beta-1

Source: includes/webapi/webapi.php:2660