Skip to main content

GVCommon

Source: includes/class-common.php:19

Details

  • Kind: class
  • Namespace: (global)

Methods

MethodDescription
clear_cache()Clears the internal microcache.
get_form()Returns the form object for a given Form ID.
get_form_or_form_template()Returns form object for existing form or a form template.
has_cap()Alias of GravityView_Roles_Capabilities::has_cap()
get_field_array()Return a Gravity Forms field array, whether using GF 1.9 or not
get_all_views()Get all existing Views
get_form_from_entry_id()Get the form array for an entry based only on the entry ID
has_product_field()Check whether a form has product fields
get_product_field_types()Return array of product field types
entry_has_transaction_data()Check if an entry has transaction data
get_entry_id_from_slug()Get the entry ID from the entry slug, which may or may not be the entry ID
get_forms_columns()Alias of GFFormsModel::get_form_ids(), but allows for fetching other columns as well.
get_forms_as_options()Get all forms to use as options in View settings.
get_forms()Alias of GFAPI::get_forms()
get_form_fields()Return array of fields' id and label, for a given Form ID
get_entry_meta()get extra fields from entry meta
get_entry_ids()Wrapper for the Gravity Forms GFFormsModel::search_lead_ids() method
calculate_get_entries_criteria()Calculates the Search Criteria used on the self::get_entries / self::get_entry methods
get_entries()Retrieve entries given search, sort, paging criteria
get_entry_id()Get the entry ID from a string that may be the Entry ID or the Entry Slug
get_entry()Return a single entry object
matches_operation()Wrapper for the GFFormsModel::matches_conditional_operation() method that adds additional comparisons, including:
check_entry_display()Checks if a certain entry is valid according to the View search filters (specially the Adv Filters)
format_date_without_timezone_offset()Formats date without applying site's timezone. This is a copy of {@see GFCommon::format_date()}.
format_date()Allow formatting date and time based on GravityView standards
get_field_label()Retrieve the label of a given field id (for a specific form)
get_field()Returns the field details array of a specific form given the field id
has_gravityview_shortcode()Check whether the post is GravityView
has_shortcode_r()Placeholder until the recursive has_shortcode() patch is merged
get_connected_views()Get the views for a particular form
get_meta_form_id()Get the Gravity Forms form ID connected to a View
get_meta_template_id()Get the template ID (list, table, datatables, map) for a View
get_template_settings()Get all the settings for a View
get_template_setting()Get the setting for a View
get_directory_fields()Get the field configuration for the View
get_directory_widgets()Get the widget configuration for a View
get_sortable_fields()Render dropdown (select) with the list of sortable fields from a form ID
get_sortable_fields_array()
get_field_type()Returns the GF Form field type for a certain field(id) of a form
is_field_numeric()Checks if the field type is a 'numeric' field type (e.g. to be used when sorting)
js_encrypt()Encrypt content using Javascript so that it's hidden when JS is disabled.
gv_parse_str()Do the same than parse_str without max_input_vars limitation:
get_link_html()Generate an HTML anchor tag with a list of supported attributes
array_merge_recursive_distinct()array_merge_recursive does indeed merge arrays, but it converts values with duplicate
get_users()Get WordPress users with reasonable limits set
generate_notice()Display updated/error notice
decode_shortcodes()Inspired on \GFCommon::encode_shortcodes, reverse the encoding by replacing the ascii characters by the shortcode brackets
send_email()Send email using GFCommon::send_email()
is_rest_request()Check if the current request is a REST request.

Method Reference

clear_cache()

public static function clear_cache(): void

Clears the internal microcache.

Returns

  • void

Since: 2.42

Source: includes/class-common.php:34

get_form()

public static function get_form( $form_id )

Returns the form object for a given Form ID.

Parameters

NameTypeDefaultDescription
$form_idint | stringThe Form ID.

Returns

  • array | false — Array: Form object returned from Gravity Forms; False: no form ID specified or Gravity Forms isn't active.

Source: includes/class-common.php:45

get_form_or_form_template()

public static function get_form_or_form_template( $form_id=0 )

Returns form object for existing form or a form template.

Parameters

NameTypeDefaultDescription
$form_idint | string0Gravity Forms form ID. Default: 0.

Returns

  • array | false

Since: 2.16

Source: includes/class-common.php:75

has_cap()

public static function has_cap( $caps='', $object_id=null, $user_id=null )

Alias of GravityView_Roles_Capabilities::has_cap()

Parameters

NameTypeDefaultDescription
$capsstring | array''Single capability or array of capabilities
$object_idintnull(optional) Parameter can be used to check for capabilities against a specific object, such as a post or user
$user_idint | nullnull(optional) Check the capabilities for a user who is not necessarily the currently logged-in user

Returns

  • bool — True: user has at least one passed capability; False: user does not have any defined capabilities

See Also

Since: 1.15

Source: includes/class-common.php:99

get_field_array()

public static function get_field_array( $field )

Return a Gravity Forms field array, whether using GF 1.9 or not

Parameters

NameTypeDefaultDescription
$fieldarray | GF_FieldsGravity Forms field or array

Returns

  • array — Array version of $field

Since: 1.7

Source: includes/class-common.php:111

get_all_views()

public static function get_all_views( $args=[] )

Get all existing Views

Parameters

NameTypeDefaultDescription
$argsarray[]Pass custom array of args, formatted as if for get_posts()

Returns

  • WP_Post[] — Array of Views as WP_Post. Empty array if none found.

Since: 1.5.4 (Added $args array)

Source: includes/class-common.php:136

get_form_from_entry_id()

public static function get_form_from_entry_id( $entry_slug )

Get the form array for an entry based only on the entry ID

Parameters

NameTypeDefaultDescription
$entry_slugint | stringEntry slug

Returns

  • array | false — Array: Form object returned from Gravity Forms; False: form doesn't exist, or $entry didn't exist or $entry didn't specify form ID

Source: includes/class-common.php:168

has_product_field()

public static function has_product_field( $form=[] )

Check whether a form has product fields

Parameters

NameTypeDefaultDescription
$formarray[]Gravity Forms form array

Returns

Since:

  • 1.16
  • 1.20 (Refactored the field types to get_product_field_types() method)

Source: includes/class-common.php:191

get_product_field_types()

public static function get_product_field_types()

Return array of product field types

Modify the value using the gform_product_field_types filter

Returns

  • array

Since: 1.20

Source: includes/class-common.php:209

entry_has_transaction_data()

public static function entry_has_transaction_data( $entry=[] )

Check if an entry has transaction data

Checks the following keys to see if they are set: 'payment_status', 'payment_date', 'transaction_id', 'payment_amount', 'payment_method'

Parameters

NameTypeDefaultDescription
$entryarray[]Gravity Forms entry array

Returns

  • bool — True: Entry has metadata suggesting it has communicated with a payment gateway; False: it does not have that data.

Since: 1.20

Source: includes/class-common.php:227

get_entry_id_from_slug()

public static function get_entry_id_from_slug( $slug )

Get the entry ID from the entry slug, which may or may not be the entry ID

Parameters

NameTypeDefaultDescription
$slugstringThe entry slug, as returned by GravityView_API::get_entry_slug()

Returns

  • int | null — The entry ID, if exists; NULL if not

Since: 1.5.2

Source: includes/class-common.php:261

get_forms_columns()

public static function get_forms_columns( $active=true, $trash=false, $sort_column='id', $sort_dir='ASC', $columns=['id'] )

Alias of GFFormsModel::get_form_ids(), but allows for fetching other columns as well.

Parameters

NameTypeDefaultDescription
$activebooltrueTrue if active forms are returned. False to get inactive forms. Defaults to true.
$trashboolfalseTrue if trashed forms are returned. False to exclude trash. Defaults to false.
$sort_columnstring'id'The column to sort the results on.
$sort_dirstring'ASC'The sort direction, ASC or DESC.
$columnsarray['id']The columns to return. Defaults to ['id']. Other options are 'title', 'date_created', 'is_active', 'is_trash'. 'date_updated' may be supported, depending on the Gravity Forms version.

Returns

  • array — Forms indexed from 0 by SQL result row number. Each row is an associative array (column => value).

See Also

Since: 2.17.2

Source: includes/class-common.php:310

get_forms_as_options()

public static function get_forms_as_options( $active=true, $trash=false, $sort_column='id', $sort_dir='ASC' )

Get all forms to use as options in View settings.

Parameters

NameTypeDefaultDescription
$activebooltrueTrue if active forms are returned. False to get inactive forms. Defaults to true.
$trashboolfalseTrue if trashed forms are returned. False to exclude trash. Defaults to false.
$sort_columnstring'id'The column to sort the results on.
$sort_dirstring'ASC'The sort direction, ASC or DESC.

Returns

  • array

Since: 2.17

Source: includes/class-common.php:356

get_forms()

public static function get_forms( $active=true, $trash=false, $order_by='id', $order='ASC' )

Alias of GFAPI::get_forms()

Parameters

NameTypeDefaultDescription
$activebool | stringtrueStatus of forms. Use any to get array of forms with any status. Default: true.
$trashboolfalseInclude forms in trash? Default: false.
$order_bystring | array'id'Optional. Either the field name to order by or an array of multiple orderby fields as $orderby => $order.
$orderstring'ASC'Optional. Either 'ASC' or 'DESC'. Only used if $orderby is a string.

Returns

  • array — Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms.

See Also

Since:

  • 1.19 (Allow "any" $active status option.)
  • 2.7.2 (Allow sorting forms using wp_list_sort().)
  • 2.17.6 (Added gravityview/common/get_forms filter.)

Source: includes/class-common.php:418

get_form_fields()

public static function get_form_fields( $form='', $add_default_properties=false, $include_parent_field=true )

Return array of fields' id and label, for a given Form ID

Parameters

NameTypeDefaultDescription
$form''
$add_default_propertiesboolfalse
$include_parent_fieldbooltrue
$form_idstring | array''(default: '') or $form object

Returns

  • array

Source: includes/class-common.php:469

get_entry_meta()

public static function get_entry_meta( $form_id, $only_default_column=true )

get extra fields from entry meta

Parameters

NameTypeDefaultDescription
$form_idstring''(default: '')
$only_default_columntrue

Returns

  • array

Source: includes/class-common.php:593

get_entry_ids()

public static function get_entry_ids( $form_id, $search_criteria=[] )

Wrapper for the Gravity Forms GFFormsModel::search_lead_ids() method

Parameters

NameTypeDefaultDescription
$form_idintID of the Gravity Forms form
$search_criteria[]

Returns

  • array | void — Array of entry IDs. Void if Gravity Forms isn't active.

See Also

  • \GFEntryList::leads_page()

Since: 1.1.6

Source: includes/class-common.php:620

calculate_get_entries_criteria()

public static function calculate_get_entries_criteria( $passed_criteria=[], $form_ids=[] )

Calculates the Search Criteria used on the self::get_entries / self::get_entry methods

Parameters

NameTypeDefaultDescription
$passed_criteriaarray[]array Input Criteria (search_criteria, sorting, paging)
$form_idsarray[]array Gravity Forms form IDs

Returns

  • array

Since: 1.7.4

Source: includes/class-common.php:638

get_entries()

public static function get_entries( $form_ids=null, $passed_criteria=null, &$total=null )

Retrieve entries given search, sort, paging criteria

Parameters

NameTypeDefaultDescription
$form_idsint | arraynullThe ID of the form or an array IDs of the Forms. Zero for all forms.
$passed_criteriamixednull(default: null)
&$totalmixednullOptional. An output parameter containing the total number of entries. Pass a non-null value to generate the total count. (default: null)

Returns

  • mixed — False: Error fetching entries. Array: Multi-dimensional array of Gravity Forms entry arrays

See Also

Deprecated: \GV\View::get_entries()

Source: includes/class-common.php:745

get_entry_id()

public static function get_entry_id( $entry_id_or_slug='', $force_allow_ids=false )

Get the entry ID from a string that may be the Entry ID or the Entry Slug

Parameters

NameTypeDefaultDescription
$entry_id_or_slugstring''The ID or slug of an entry.
$force_allow_idsboolfalseWhether to force allowing getting the ID of an entry, even if custom slugs are enabled

Returns

  • false | int | null — Returns the ID of the entry found, if custom slugs is enabled. Returns original value if custom slugs is disabled. Returns false if not allowed to convert slug to ID. Returns NULL if entry not found for the passed slug.

Since: 1.18

Source: includes/class-common.php:852

get_entry()

public static function get_entry( $entry_slug, $force_allow_ids=false, $check_entry_display=true, $view=null )

Return a single entry object

Since 1.4, supports custom entry slugs. The way that GravityView fetches an entry based on the custom slug is by searching gravityview_unique_id meta. The $entry_slug is fetched by getting the current query var set by is_single_entry()

Parameters

NameTypeDefaultDescription
$entry_slugstring | intEither entry ID or entry slug string
$force_allow_idsbooleanfalseForce the get_entry() method to allow passed entry IDs, even if the gravityview_custom_entry_slug_allow_id filter returns false.
$check_entry_displaybooleantrueCheck whether the entry is visible for the current View configuration. Default: true. {@since 1.14}
$view\GV\View | nullnullThe View if $check_entry_display is set to true. In legacy context mocks, can be null. {@since develop}

Returns

  • array | boolean

Source: includes/class-common.php:910

matches_operation()

public static function matches_operation( $val1, $val2, $operation )

Wrapper for the GFFormsModel::matches_conditional_operation() method that adds additional comparisons, including:

'equals', 'greater_than_or_is', 'greater_than_or_equals', 'less_than_or_is', 'less_than_or_equals', 'not_contains', 'in', and 'not_in'

Parameters

NameTypeDefaultDescription
$val1mixedLeft side of comparison
$val2mixedRight side of comparison
$operationstringType of comparison

Returns

  • bool — True: matches, false: not matches

See Also

Since:

  • 1.7.5
  • 1.13 (You can define context, which displays/hides based on what's being displayed (single, multiple, edit))
  • 1.22.1 (Added 'in' and 'not_in' for JSON-encoded array values, serialized non-strings)
  • 2.33 (Uses GFFormsModel::matches_operation or GFFormsModel::matches_conditional_operation depending on the Gravity Forms version.)

Source: includes/class-common.php:983

check_entry_display()

public static function check_entry_display( $entry, $view=null )

Checks if a certain entry is valid according to the View search filters (specially the Adv Filters)

Parameters

NameTypeDefaultDescription
$entryarrayGravity Forms Entry object
$view\GV\View | \GV\View_CollectionnullThe View or a View Collection

Returns

  • WP_Error | array — Returns WP_Error if entry is not valid according to the view search filters (Adv Filter). Returns original $entry value if passes.

See Also

Since:

Source: includes/class-common.php:1108

format_date_without_timezone_offset()

public static function format_date_without_timezone_offset( $gmt_datetime, $is_human=true, $date_format='', $include_time=true )

Formats date without applying site's timezone. This is a copy of {@see GFCommon::format_date()}.

Parameters

NameTypeDefaultDescription
$gmt_datetimestringThe UTC date/time value to be formatted.
$is_humanbooltrueIndicates if a human-readable time difference such as "1 hour ago" should be returned when within 24hrs of the current time. Defaults to true.
$date_formatstring''The format the value should be returned in. Defaults to an empty string; the date format from the WordPress general settings, if configured, or Y-m-d.
$include_timebooltrueIndicates if the time should be included in the returned string. Defaults to true; the time format from the WordPress general settings, if configured, or H:i.

Returns

  • string

Since: 2.33

Source: includes/class-common.php:1240

format_date()

public static function format_date( $date_string='', $args=[] )

Allow formatting date and time based on GravityView standards

Parameters

NameTypeDefaultDescription
$date_stringstring''The date as stored by Gravity Forms (Y-m-d h:i:s GMT)
$argsstring | array[]{ Settings to define how you want the date to be formatted.

Returns

  • int | null | string — Formatted date based on the original date

See Also

  • GVCommon_Test::test_format_date for examples

Since: 1.16

Source: includes/class-common.php:1289

get_field_label()

public static function get_field_label( $form=[], $field_id='', $field_value='' )

Retrieve the label of a given field id (for a specific form)

Parameters

NameTypeDefaultDescription
$formarray[]Gravity Forms form array
$field_idstring''ID of the field. If an input, full input ID (like 1.3)
$field_valuestring | array''Raw value of the field.

Returns

  • string

Since: 1.17 (Added $field_value parameter)

Source: includes/class-common.php:1355

get_field()

public static function get_field( $form, $field_id )

Returns the field details array of a specific form given the field id

Alias of \GFFormsModel::get_field()

Parameters

NameTypeDefaultDescription
$formarray | intForm array or ID
$field_idstring | int

Returns

  • GF_Field | null — Gravity Forms field object, or NULL: Gravity Forms GFFormsModel does not exist or field at $field_id doesn't exist.

See Also

  • GFFormsModel::get_field

Since: 1.19 (Allow passing form ID as well as form array)

Source: includes/class-common.php:1386

has_gravityview_shortcode()

public static function has_gravityview_shortcode( $post=null )

Check whether the post is GravityView

  • Check post type. Is it gravityview?
  • Check shortcode

Parameters

NameTypeDefaultDescription
$postWP_PostnullWordPress post object

Returns

  • boolean — True: yep, GravityView; No: not!

Source: includes/class-common.php:1403

has_shortcode_r()

public static function has_shortcode_r( $content, $tag='gravityview' )

Placeholder until the recursive has_shortcode() patch is merged

Parameters

NameTypeDefaultDescription
$contentstringContent to check whether there's a shortcode
$tagstring'gravityview'Current shortcode tag

See Also

Source: includes/class-common.php:1423

get_connected_views()

public static function get_connected_views( $form_id, $args=[], $include_joins=true )

Get the views for a particular form

Parameters

NameTypeDefaultDescription
$form_idintGravity Forms form ID
$argsarray[]Pass args sent to get_posts()
$include_joinsbooltrueWhether to include forms that are joined to the View

Returns

  • array — Array with view details, as returned by get_posts()

Since:

  • 1.15.2 (Add $args array and limit posts_per_page to 500)
  • 2.19 (Added $include_joins param)

Source: includes/class-common.php:1471

get_meta_form_id()

public static function get_meta_form_id( $view_id )

Get the Gravity Forms form ID connected to a View

Parameters

NameTypeDefaultDescription
$view_idintThe ID of the View to get the connected form of

Returns

  • false | string — ID of the connected Form, if exists. Empty string if not. False if not the View ID isn't valid.

Source: includes/class-common.php:1528

get_meta_template_id()

public static function get_meta_template_id( $view_id, string $section='directory' )

Get the template ID (list, table, datatables, map) for a View

Parameters

NameTypeDefaultDescription
$view_idintThe ID of the View to get the layout of.
$sectionstring'directory'The view section.

Returns

  • string — GravityView_Template::template_id value. Empty string if not.

See Also

  • GravityView_Template::template_id

Source: includes/class-common.php:1542

get_template_settings()

public static function get_template_settings( $post_id )

Get all the settings for a View

Parameters

NameTypeDefaultDescription
$post_idintView ID

Returns

  • array — Associative array of settings with plugin defaults used if not set by the View

Source: includes/class-common.php:1575

get_template_setting()

public static function get_template_setting( $post_id, $key )

Get the setting for a View

If the setting isn't set by the View, it returns the plugin default.

Parameters

NameTypeDefaultDescription
$post_idintView ID
$keystringKey for the setting

Returns

  • mixed | null — Setting value, or NULL if not set.

Source: includes/class-common.php:1602

get_directory_fields()

public static function get_directory_fields( $post_id, $apply_filter=true, $form_id=0 )

Get the field configuration for the View


array(

[other zones]

'directory_list-title' => array(

[other fields]

'5372653f25d44' => array(
'id' => string '9' (length=1)
'label' => string 'Screenshots' (length=11)
'show_label' => string '1' (length=1)
'custom_label' => string '' (length=0)
'custom_class' => string 'gv-gallery' (length=10)
'only_loggedin' => string '0' (length=1)
'only_loggedin_cap' => string 'read' (length=4)
)

[other fields]
)

[other zones]
)

Parameters

NameTypeDefaultDescription
$post_idintView ID.
$apply_filterbooltrueWhether to apply the gravityview/configuration/fields filter [Default: true]
$form_id0

Returns

  • array — Multi-array of fields with first level being the field zones. See code comment.

Since:

  • 1.17.4 (Added $apply_filter parameter.)
  • 2.17 (Added $form_id parameter.)

Source: includes/class-common.php:1649

get_directory_widgets()

public static function get_directory_widgets( $view_id, $json_decode=false )

Get the widget configuration for a View

Parameters

NameTypeDefaultDescription
$view_idintView ID
$json_decodeboolfalseWhether to JSON-decode the widget values. Default: false

Returns

  • array — Multi-array of widgets, with the slug of each widget "zone" being the key ("header_top"), and each widget having their own "id"

Source: includes/class-common.php:1689

get_sortable_fields()

public static function get_sortable_fields( $formid, $current='id' )

Render dropdown (select) with the list of sortable fields from a form ID

Parameters

NameTypeDefaultDescription
$formidintForm ID
$currentstring'id'Current selected field ID

Returns

  • string — html

Source: includes/class-common.php:1719

get_sortable_fields_array()

public static function get_sortable_fields_array( $formid, $blocklist=['list', 'textarea'] )

Parameters

NameTypeDefaultDescription
$formidintGravity Forms form ID
$blocklistarray['list', 'textarea']Field types to exclude

Returns

  • array

Since: 1.8

Source: includes/class-common.php:1767

get_field_type()

public static function get_field_type( $form=null, $field_id='' )

Returns the GF Form field type for a certain field(id) of a form

Parameters

NameTypeDefaultDescription
$formobjectnullGravity Forms form
$field_idmixed''Field ID or Field array

Returns

  • string — field type

Source: includes/class-common.php:1834

is_field_numeric()

public static function is_field_numeric( $form=null, $field='' )

Checks if the field type is a 'numeric' field type (e.g. to be used when sorting)

Parameters

NameTypeDefaultDescription
$formint | arraynullform ID or form array
$fieldint | array''field key or field array

Returns

  • boolean

Source: includes/class-common.php:1853

js_encrypt()

public static function js_encrypt( $content, $message='' )

Encrypt content using Javascript so that it's hidden when JS is disabled.

This is mostly used to hide email addresses from scraper bots.

Parameters

NameTypeDefaultDescription
$contentstringContent to encrypt
$messagestring''Message shown if Javascript is disabled

Returns

  • string — Content, encrypted

See Also

Since: 1.7

Source: includes/class-common.php:1901

gv_parse_str()

public static function gv_parse_str( $string, &$result )

Do the same than parse_str without max_input_vars limitation:

Parses $string as if it were the query string passed via a URL and sets variables in the current scope.

Parameters

NameTypeDefaultDescription
$stringstring string to parse (not altered like in the original parse_str(), use the second parameter!)
&$resultarray If the second parameter is present, variables are stored in this variable as array elements

Returns

  • bool — true or false if $string is an empty string

See Also

Since: 1.5.3

Source: includes/class-common.php:1943

public static function get_link_html( $href='', $anchor_text='', $atts=[] )

Generate an HTML anchor tag with a list of supported attributes

Parameters

NameTypeDefaultDescription
$hrefstring''URL of the link. Sanitized using esc_url_raw()
$anchor_textstring''The text or HTML inside the anchor. This is not sanitized in the function.
$attsarray | string[]Attributes to be added to the anchor tag. Parsed by wp_parse_args(), sanitized using esc_attr()

Returns

  • string — HTML output of anchor link. If empty $href, returns NULL

See Also

Since: 1.6

Source: includes/class-common.php:1983

array_merge_recursive_distinct()

public static function array_merge_recursive_distinct( array&$array1, array&$array2 )

array_merge_recursive does indeed merge arrays, but it converts values with duplicate

keys to arrays rather than overwriting the value in the first array with the duplicate value in the second array, as array_merge does.

Parameters

NameTypeDefaultDescription
&$array1array
&$array2array

Returns

  • array

See Also

Since: 1.5.3

Source: includes/class-common.php:2081

get_users()

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

Get WordPress users with reasonable limits set

Parameters

NameTypeDefaultDescription
$contextstring'change_entry_creator'Where are we using this information (e.g. change_entry_creator, search_widget ..)
$argsarray[]Arguments to modify the user query. See get_users() {@since 1.14}

Returns

  • array — Array of WP_User objects.

Source: includes/class-common.php:2103

generate_notice()

public static function generate_notice( $notice, $class='', $cap='', $object_id=null )

Display updated/error notice

Parameters

NameTypeDefaultDescription
$noticestringtext/HTML of notice
$classstring''CSS class for notice (updated or error)
$capstring''[Optional] Define a capability required to show a notice. If not set, displays to all caps.
$object_idnull

Returns

  • string

Since: 1.19.2 (Added $cap and $object_id parameters)

Source: includes/class-common.php:2143

decode_shortcodes()

public static function decode_shortcodes( $string )

Inspired on \GFCommon::encode_shortcodes, reverse the encoding by replacing the ascii characters by the shortcode brackets

Parameters

NameTypeDefaultDescription
$stringstringInput string to decode

Returns

  • string — $string Output string

Since: 1.16.5

Source: includes/class-common.php:2160

send_email()

public static function send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name='', $message_format='html', $attachments='', $entry=false, $notification=false )

Send email using GFCommon::send_email()

Parameters

NameTypeDefaultDescription
$fromstringSender address (required)
$tostringRecipient address (required)
$bccstringBCC recipients (required)
$reply_tostringReply-to address (required)
$subjectstringSubject line (required)
$messagestringMessage body (required)
$from_namestring''Displayed name of the sender
$message_formatstring'html'If "html", sent text as text/html. Otherwise, text/plain. Default: "html".
$attachmentsstring | array''Optional. Files to attach. \wp_mail for usage. Default: "".
$entryarray | falsefalseGravity Forms entry array, related to the email. Default: false.
$notificationarray | falsefalseGravity Forms notification that triggered the email. \GFCommon::send_notification(). Default:false.

See Also

  • GFCommon::send_email This just makes the method public

Since: 1.17

Source: includes/class-common.php:2188

is_rest_request()

public static function is_rest_request()

Check if the current request is a REST request.

Returns

  • bool — True if the request is a REST request, false otherwise.

Since: 2.41

Source: includes/class-common.php:2207