GravityView  1.19.4
The best, easiest way to display Gravity Forms entries on your website.
Static Public Member Functions
GVCommon Class Reference

If this file is called directly, abort. More...

Static Public Member Functions

static 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. More...
 
static calculate_get_entries_criteria ($passed_criteria=array(), $form_ids=array())
 Calculates the Search Criteria used on the self::get_entries / self::get_entry methods. More...
 
static check_entry_display ($entry)
 Checks if a certain entry is valid according to the View search filters (specially the Adv Filters) More...
 
static decode_shortcodes ($string)
 Inspired on ::encode_shortcodes, reverse the encoding by replacing the ascii characters by the shortcode brackets. More...
 
static format_date ($date_string= '', $args=array())
 Allow formatting date and time based on GravityView standards. More...
 
static generate_notice ($notice, $class= '', $cap= '', $object_id=null)
 Display updated/error notice. More...
 
static get_all_views ($args=array())
 Get all existing Views. More...
 
static get_connected_views ($form_id, $args=array())
 Get the views for a particular form. More...
 
static get_directory_fields ($post_id, $apply_filter=true)
 Get the field configuration for the View. More...
 
static get_entries ($form_ids=null, $passed_criteria=null, &$total=null)
 Retrieve entries given search, sort, paging criteria. More...
 
static get_entry ($entry_slug, $force_allow_ids=false, $check_entry_display=true)
 Return a single entry object. More...
 
static 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. More...
 
static get_entry_id_from_slug ($slug)
 Get the entry ID from the entry slug, which may or may not be the entry ID. More...
 
static get_entry_ids ($form_id, $search_criteria=array())
 Wrapper for the Gravity Forms GFFormsModel::search_lead_ids() method. More...
 
static get_entry_meta ($form_id, $only_default_column=true)
 get extra fields from entry meta More...
 
static get_field ($form, $field_id)
 Returns the field details array of a specific form given the field id. More...
 
static get_field_array ($field)
 Return a Gravity Forms field array, whether using GF 1.9 or not. More...
 
static get_field_label ($form=array(), $field_id= '', $field_value= '')
 Retrieve the label of a given field id (for a specific form) More...
 
static get_field_type ($form=null, $field_id= '')
 Returns the GF Form field type for a certain field(id) of a form. More...
 
static get_form ($form_id)
 Returns the form object for a given Form ID. More...
 
static get_form_fields ($form= '', $add_default_properties=false, $include_parent_field=true)
 Return array of fields' id and label, for a given Form ID. More...
 
static get_form_from_entry_id ($entry_slug)
 Get the form array for an entry based only on the entry ID. More...
 
static get_forms ($active=true, $trash=false)
 Alias of GFAPI::get_forms() More...
 
static get_link_html ($href= '', $anchor_text= '', $atts=array())
 Generate an HTML anchor tag with a list of supported attributes. More...
 
static get_meta_form_id ($view_id)
 Get the Gravity Forms form ID connected to a View. More...
 
static get_meta_template_id ($view_id)
 Get the template ID (list, table, datatables, map) for a View. More...
 
static get_sortable_fields ($formid, $current= '')
 Render dropdown (select) with the list of sortable fields from a form ID. More...
 
static get_sortable_fields_array ($formid, $blacklist=array( 'list', 'textarea'))
 
static get_template_setting ($post_id, $key)
 Get the setting for a View. More...
 
static get_template_settings ($post_id)
 Get all the settings for a View. More...
 
static get_users ($context= 'change_entry_creator', $args=array())
 Get WordPress users with reasonable limits set. More...
 
static 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. More...
 
static has_cap ($caps= '', $object_id=null, $user_id=null)
 Alias of GravityView_Roles_Capabilities::has_cap() More...
 
static has_gravityview_shortcode ($post=null)
 Check whether the post is GravityView. More...
 
static has_product_field ($form=array())
 Check whether a form has product fields. More...
 
static has_shortcode_r ($content, $tag= 'gravityview')
 Placeholder until the recursive has_shortcode() patch is merged. More...
 
static is_field_numeric ($form=null, $field= '')
 Checks if the field type is a 'numeric' field type (e.g. More...
 
static js_encrypt ($content, $message= '')
 Encrypt content using Javascript so that it's hidden when JS is disabled. More...
 
static matches_operation ($val1, $val2, $operation)
 Wrapper for the GFFormsModel::matches_operation() method that adds additional comparisons, including: 'equals', 'greater_than_or_is', 'greater_than_or_equals', 'less_than_or_is', 'less_than_or_equals', and 'not_contains'. More...
 
static 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() More...
 

Detailed Description

If this file is called directly, abort.

Definition at line 19 of file class-common.php.

Member Function Documentation

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

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.

See also
http://php.net/manual/en/function.array-merge-recursive.php
Since
1.5.3
Parameters
array$array1
array$array2
Returns
array
Author
Daniel <daniel (at) danielsmedegaardbuus (dot) dk>
Gabriel Sobrinho <gabriel (dot) sobrinho (at) gmail (dot) com>

Definition at line 1469 of file class-common.php.

References $value.

static calculate_get_entries_criteria (   $passed_criteria = array(),
  $form_ids = array() 
)
static

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

Since
1.7.4
Parameters
array$passed_criteriaarray Input Criteria (search_criteria, sorting, paging)
array$form_idsarray Gravity Forms form IDs
Returns
array
Runs Filter:
gravityview_search_operator Modify the search operator for the field (contains, is, isnot, etc)
Parameters
string$operatorExisting search operator
array$filterarray with key, value, operator, type keys

Prepare date formats to be in Gravity Forms DB format; $passed_criteria may include date formats incompatible with Gravity Forms.

Runs Filter:
gravityview_search_criteria Apply final criteria filter (Used by the Advanced Filter extension)
Parameters
array$criteriaSearch criteria used by GravityView
array$form_idsForms to search
int$view_idID of the view being used to search

Definition at line 373 of file class-common.php.

References $criteria, GravityView_frontend\getInstance(), and GravityView_View_Data\getInstance().

static check_entry_display (   $entry)
static

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

See also
GFFormsModel::is_value_match()
Since
1.7.4
Parameters
array$entryGravity Forms Entry object
Returns
bool|array Returns 'false' if entry is not valid according to the view search filters (Adv Filter)

Definition at line 717 of file class-common.php.

References $criteria, $entry, $field, $field_value, $form, and gravityview_get_form_id().

static decode_shortcodes (   $string)
static

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

Since
1.16.5
Parameters
string$stringInput string to decode
Returns
string $string Output string

Definition at line 1541 of file class-common.php.

static format_date (   $date_string = '',
  $args = array() 
)
static

Allow formatting date and time based on GravityView standards.

Since
1.16
See also
GVCommon_Test::test_format_date for examples
Parameters
string$date_stringThe date as stored by Gravity Forms (Y-m-d h:i:s GMT)
string | array$argsArray or string of settings for output parsed by wp_parse_args(); Can use raw=1 or `array('raw' => true)\n -rawUn-formatted date string in originalY-m-d h:i:sformat -timestampInteger timestamp returned by GFCommon::get_local_timestamp() -diff"%s ago" format, unless otherformatis defined -humanSet $is_human parameter to true forGFCommon::format_date(). Showsdiffwithin 24 hours or date after. Format based on blog setting, unlessformatis defined. -timeInclude time in theGFCommon::format_date()output -formatDefine your own date format, ordiff` format
Returns
int|null|string Formatted date based on the original date

Gravity Forms code to adjust date to locally-configured Time Zone

See also
GFCommon::format_date() for original code

Definition at line 833 of file class-common.php.

References $format.

Referenced by GravityView_Merge_Tags\format_date(), and GravityView_Field_Date_Created\get_content().

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

Display updated/error notice.

Since
1.19.2 Added $cap and $object_id parameters
Parameters
string$noticetext/HTML of notice
string$classCSS class for notice (updated or error)
string$cap[Optional] Define a capability required to show a notice. If not set, displays to all caps.
Returns
string

Definition at line 1525 of file class-common.php.

References $class, and has_cap().

Referenced by GravityView_frontend\context_not_configured_warning(), GravityView_Welcome\getting_started_screen(), GravityView_Edit_Entry_Render\maybe_print_message(), GravityView_Edit_Entry_Render\user_can_edit_entry(), and GravityView_Edit_Entry_Render\user_can_edit_field().

static get_all_views (   $args = array())
static

Get all existing Views.

Since
1.5.4
TODO Added $args array
Parameters
array$argsPass custom array of args, formatted as if for get_posts()
Returns
array Array of Views as WP_Post. Empty array if none found.
Runs Filter:
gravityview/get_all_views/params Modify the parameters sent to get all views.
Parameters
[in,out]array$paramsArray of parameters to pass to get_posts()

Definition at line 96 of file class-common.php.

Referenced by GravityView_Search_WP_Widget\form().

static get_connected_views (   $form_id,
  $args = array() 
)
static

Get the views for a particular form.

Since
1.15.2 Add $args array and limit posts_per_page to 500

get_posts()

Parameters
int$form_idGravity Forms form ID
array$argsPass args sent to get_posts()
Returns
array Array with view details, as returned by get_posts()

Definition at line 1014 of file class-common.php.

References $form_id.

Referenced by gravityview_get_connected_views().

static get_directory_fields (   $post_id,
  $apply_filter = true 
)
static

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] )

Since
1.17.4 Added $apply_filter parameter
Parameters
int$post_idView ID
bool$apply_filterWhether to apply the gravityview/configuration/fields filter [Default: true]
Returns
array Multi-array of fields with first level being the field zones. See code comment.
Runs Filter:
gravityview/configuration/fields Filter the View fields' configuration array
Since
1.6.5
Parameters
$fieldsarray Multi-array of fields with first level being the field zones
$post_idint Post ID

Definition at line 1131 of file class-common.php.

Referenced by gravityview_get_directory_fields().

static get_entries (   $form_ids = null,
  $passed_criteria = null,
$total = null 
)
static

Retrieve entries given search, sort, paging criteria.

See also
GFAPI::get_entries()
GFFormsModel::get_field_filters_where() public
Parameters
int | array$form_idsThe ID of the form or an array IDs of the Forms. Zero for all forms.
mixed$passed_criteria(default: null)
mixed&$totalOptional. 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

Reduce # of database calls

Runs Filter:
gravityview_pre_get_entries Define entries to be used before GFAPI::get_entries() is called
Since
1.14
Parameters
null$returnIf you want to override GFAPI::get_entries() and define entries yourself, tap in here.
array$criteriaThe final search criteria used to generate the request to GFAPI::get_entries()
array$passed_criteriaThe original search criteria passed to GVCommon::get_entries()
int | null$totalOptional. An output parameter containing the total number of entries. Pass a non-null value to generate

Remove filter added above

Runs Filter:
gravityview_entries Modify the array of entries returned to GravityView after it has been fetched from the cache or from GFAPI::get_entries().
Parameters
array | null$entriesArray of entries as returned by the cache or by GFAPI::get_entries()
array$criteriaThe final search criteria used to generate the request to GFAPI::get_entries()
array$passed_criteriaThe original search criteria passed to GVCommon::get_entries()
int | null$totalOptional. An output parameter containing the total number of entries. Pass a non-null value to generate

Definition at line 469 of file class-common.php.

References $criteria, $entries, and GravityView_Cache.

Referenced by GravityView_Recent_Entries_Widget\get_entries(), and gravityview_get_entries().

static get_entry (   $entry_slug,
  $force_allow_ids = false,
  $check_entry_display = true 
)
static

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()

public

Parameters
string | int$entry_slugEither entry ID or entry slug string
boolean$force_allow_idsForce the get_entry() method to allow passed entry IDs, even if the gravityview_custom_entry_slug_allow_id filter returns false.
boolean$check_entry_displayCheck whether the entry is visible for the current View configuration. Default: true. {
Since
1.14}
Returns
array|boolean
Runs Filter:
gravityview/common/get_entry/check_entry_display Override whether to check entry display rules against filters
Since
1.16.2
Parameters
bool$check_entry_displayCheck whether the entry is visible for the current View configuration. Default: true.
array$entryGravity Forms entry array

Definition at line 605 of file class-common.php.

References $entry, and $entry_slug.

Referenced by GravityView_API\entry_link(), GravityView_Entry_Link_Shortcode\get_entry(), gravityview_get_entry(), and GravityView_frontend\setEntry().

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

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

Since
TODO
Parameters
string$entry_id_or_slugThe ID or slug of an entry.
bool$force_allow_idsWhether 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.
Runs Filter:
gravityview_custom_entry_slug Whether to enable and use custom entry slugs.
Parameters
booleanTrue: Allow for slugs based on entry values. False: always use entry IDs (default)
Runs Filter:
gravityview_custom_entry_slug_allow_id When using a custom slug, allow access to the entry using the original slug (the Entry ID).
  • If disabled (default), only allow access to an entry using the custom slug value. (example: /entry/custom-slug/ NOT /entry/123/)
  • If enabled, you could access using the custom slug OR the entry id (example: /entry/custom-slug/ OR /entry/123/)
Parameters
boolean$custom_slug_id_accessTrue: allow accessing the slug by ID; False: only use the slug passed to the method.

If we're using custom entry slugs, we do a meta value search instead of doing a straightup ID search.

Definition at line 557 of file class-common.php.

Referenced by GravityView_Entry_Approval\ajax_update_approved(), and GravityView_Entry_Approval\get_entry_status().

static get_entry_id_from_slug (   $slug)
static

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

Since
1.5.2
Parameters
string$slugThe entry slug, as returned by GravityView_API::get_entry_slug()
Returns
int|null The entry ID, if exists; NULL if not
Runs Filter:
gravityview/common/get_entry_id_from_slug/form_id The form ID used to get the custom entry ID. Change this to avoid collisions with data from other forms with the same values and the same field ID.
Since
1.17.2
Parameters
int$form_idID of the form to search. Default: 0 (searches all forms)

Definition at line 161 of file class-common.php.

References $form_id.

static get_entry_ids (   $form_id,
  $search_criteria = array() 
)
static

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

See also
GFEntryList::leads_page()
Parameters
int$form_idID of the Gravity Forms form
Since
1.1.6
Returns
array|void Array of entry IDs. Void if Gravity Forms isn't active.

Definition at line 355 of file class-common.php.

References $form_id.

Referenced by gravityview_get_entry_ids().

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

get extra fields from entry meta

Parameters
string$form_id(default: '')
Returns
array

Definition at line 331 of file class-common.php.

References $field, and $form_id.

Referenced by gravityview_get_entry_meta().

static get_field (   $form,
  $field_id 
)
static

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

Alias of GFFormsModel::get_field

Since
1.19 Allow passing form ID as well as form array

GFFormsModel::get_field

See also
GFFormsModel::get_field public
Parameters
array | int$formForm array or ID
string | int$field_id
Returns
GF_Field|null Gravity Forms field object, or NULL: Gravity Forms GFFormsModel does not exist or field at $field_id doesn't exist.

Definition at line 925 of file class-common.php.

References $field_id, and $form.

Referenced by gravityview_get_field().

static get_field_array (   $field)
static

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

Since
1.7
Parameters
array | GF_Fields$fieldGravity Forms field or array
Returns
array Array version of $field

Definition at line 70 of file class-common.php.

References $field.

static get_field_label (   $form = array(),
  $field_id = '',
  $field_value = '' 
)
static

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

public

Since
1.17 Added $field_value parameter
Parameters
array$formGravity Forms form array
string$field_idID of the field. If an input, full input ID (like 1.3)
string | array$field_valueRaw value of the field.
Returns
string

Definition at line 893 of file class-common.php.

References $field, $field_id, $field_value, $form, and $label.

Referenced by gravityview_get_field_label().

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

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

Parameters
object$formGravity Forms form
mixed$field_idField ID or Field array
Returns
string field type

Definition at line 1233 of file class-common.php.

References $field, $field_id, and $form.

Referenced by gravityview_get_field_type().

static get_form (   $form_id)
static

Returns the form object for a given Form ID.

public

Parameters
mixed$form_id
Returns
array|false Array: Form object returned from Gravity Forms; False: no form ID specified or Gravity Forms isn't active.

Definition at line 28 of file class-common.php.

References $form_id.

Referenced by GravityView_Field\_filter_gform_custom_merge_tags(), gravityview_get_form(), GravityView_Entry_Approval\update_approved_meta(), and GravityView_Search_WP_Widget\widget().

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

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

public

Parameters
string | array$form_id(default: '') or $form object
bool$add_default_properties
bool$include_parent_field
Returns
array

In case of email/email confirmation, the input for email has the same id as the parent field

Since
1.7
Runs Filter:
gravityview/common/get_form_fields Modify the form fields shown in the Add Field field picker.
Since
1.17
Parameters
array$fieldsAssociative array of fields, with keys as field type, values an array with the following keys: (string) label (required), (string) type (required), desc, (string) customLabel, (GF_Field) parent, (string) adminLabel, (bool)adminOnly
array$formGF Form array
bool$include_parent_fieldWhether to include the parent field when getting a field with inputs

Definition at line 229 of file class-common.php.

References $field, $form, and GravityView_Fields\get_all().

Referenced by gravityview_get_form_fields().

static get_form_from_entry_id (   $entry_slug)
static

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

Parameters
int | string$entry_slugEntry 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

Definition at line 123 of file class-common.php.

References $entry, $entry_slug, and $form.

Referenced by GravityView_Welcome\getting_started_screen(), and gravityview_get_form_from_entry_id().

static get_forms (   $active = true,
  $trash = false 
)
static

Alias of GFAPI::get_forms()

See also
GFAPI::get_forms()
Since
1.19 Allow "any" $active status option
Parameters
bool | string$activeStatus of forms. Use any to get array of forms with any status. Default: true
bool$trashInclude forms in trash? Default: false
Returns
array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms

Definition at line 206 of file class-common.php.

References $forms.

Referenced by gravityview_get_forms().

static get_link_html (   $href = '',
  $anchor_text = '',
  $atts = array() 
)
static

Generate an HTML anchor tag with a list of supported attributes.

See also
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a Supported attributes defined here esc_url_raw() to sanitize $href esc_attr() to sanitize $atts
Since
1.6
Parameters
string$hrefURL of the link. Sanitized using esc_url_raw()
string$anchor_textThe text or HTML inside the anchor. This is not sanitized in the function.
array | string$attsAttributes 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
Runs Filter:
gravityview/get_link/allowed_atts Modify the attributes that are allowed to be used in generating links
Parameters
array$allowed_attsArray of attributes allowed

Fix potential security issue with target=_blank

See also
https://dev.to/ben/the-targetblank-vulnerability-by-example

Definition at line 1377 of file class-common.php.

References $href, $output, and $value.

Referenced by gravityview_get_link().

static get_meta_form_id (   $view_id)
static

Get the Gravity Forms form ID connected to a View.

Parameters
int$view_idThe 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.

Definition at line 1037 of file class-common.php.

References $view_id.

Referenced by gravityview_get_form_id(), and GravityView_Search_WP_Widget\widget().

static get_meta_template_id (   $view_id)
static

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

See also
GravityView_Template::template_id
Parameters
int$view_idThe ID of the View to get the layout of
Returns
string GravityView_Template::template_id value. Empty string if not.

Definition at line 1050 of file class-common.php.

References $view_id.

Referenced by gravityview_get_template_id().

static get_sortable_fields (   $formid,
  $current = '' 
)
static

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

public

Parameters
int$formidForm ID
Returns
string html

Definition at line 1156 of file class-common.php.

References $field, and $output.

Referenced by gravityview_get_sortable_fields().

static get_sortable_fields_array (   $formid,
  $blacklist = array( 'list', 'textarea' ) 
)
static
Parameters
int$formidGravity Forms form ID
array$blacklistField types to exclude
Since
1.8
Returns
array
Runs Filter:
gravityview/common/sortable_fields Filter the sortable fields
Since
1.12
Parameters
array$fieldsSub-set of GF form fields that are sortable
int$formidThe Gravity Forms form ID that the fields are from

Definition at line 1192 of file class-common.php.

References $field.

static get_template_setting (   $post_id,
  $key 
)
static

Get the setting for a View.

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

Parameters
int$post_idView ID
string$keyKey for the setting
Returns
mixed|null Setting value, or NULL if not set.

Definition at line 1087 of file class-common.php.

Referenced by GravityView_Edit_Entry\check_user_cap_edit_entry(), and gravityview_get_template_setting().

static get_template_settings (   $post_id)
static

Get all the settings for a View.

GravityView_View_Data::get_default_args() Parses the settings with the plugin defaults as backups.

Parameters
int$post_idView ID
Returns
array Associative array of settings with plugin defaults used if not set by the View

Definition at line 1062 of file class-common.php.

References GravityView_View_Data\get_default_args().

Referenced by gravityview_get_template_settings().

static get_users (   $context = 'change_entry_creator',
  $args = array() 
)
static

Get WordPress users with reasonable limits set.

Parameters
string$contextWhere are we using this information (e.g. change_entry_creator, search_widget ..)
array$argsArguments to modify the user query. See get_users() {
Since
1.14}
Returns
array Array of WP_User objects.
Runs Filter:
gravityview/get_users/{$context} There are issues with too many users using get_users() where it breaks the select. We try to keep it at a reasonable number.
$context is where are we using this information (e.g. change_entry_creator, search_widget ..)
Parameters
array$settingsSettings array, with number key defining the # of users to display

Definition at line 1491 of file class-common.php.

Referenced by GravityView_Change_Entry_Creator\add_select(), and GravityView_Widget_Search\get_created_by_choices().

static gv_parse_str (   $string,
$result 
)
static

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
$stringarray 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
Since
1.5.3
Author
rubo77 at https://gist.github.com/rubo77/6821632

Definition at line 1337 of file class-common.php.

Referenced by _gravityview_process_posted_fields().

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

Alias of GravityView_Roles_Capabilities::has_cap()

Since
1.15
See also
GravityView_Roles_Capabilities::has_cap()
Parameters
string | array$capsSingle capability or array of capabilities
int$object_id(optional) Parameter can be used to check for capabilities against a specific object, such as a post or user
int | null$user_id(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

Definition at line 58 of file class-common.php.

References GravityView_Roles_Capabilities\has_cap().

Referenced by GravityView_Support_Port\_localize_script(), GravityView_Compatibility\_shortcode_gf_notice(), GravityView_Admin_ApproveEntries\add_entry_approved_hidden_input(), GravityView_Admin_Bar\add_floaty_icon(), GravityView_Admin_Bar\add_hooks(), GravityView_Admin_Views\add_post_type_columns(), GravityView_Admin_ApproveEntries\add_scripts_and_styles(), GravityView_frontend\add_scripts_and_styles(), GravityView_Admin_Add_Shortcode\add_shortcode_button(), GravityView_Admin_Notices\admin_notice(), GravityView_Entry_Approval\ajax_update_approved(), app_settings_fields(), GravityView_Delete_Entry\check_user_cap_delete_entry(), GravityView_Edit_Entry\check_user_cap_edit_entry(), GravityView_Edit_Entry_Render\check_user_cap_edit_field(), GravityView_Settings\current_user_can_any(), GravityView_Admin_Duplicate_View\current_user_can_copy(), GravityView_Field_Notes\display_note(), GravityView_Edit_Entry_Render\filter_admin_only_fields(), generate_notice(), GravityView_Field_Notes\get_add_note_part(), GravityView_Admin_Views\get_connected_form_links(), GravityView_Field_Notes\get_note_email_fields(), GravityView_Admin_Views\gform_toolbar_menu(), GravityView_View_Data\hide_field_check_conditions(), GravityView_frontend\is_entry_approved(), GV_License_Handler\license_call(), GravityView_Change_Entry_Creator\load(), GravityView_Field_Notes\maybe_add_note(), GravityView_Field_Notes\maybe_delete_notes(), GravityView_Field_Entry_Approval\maybe_prevent_field_render(), maybe_save_app_settings(), GravityView_Field_Notes\maybe_send_entry_notes(), GravityView_Edit_Entry_Render\maybe_update_post_fields(), GravityView_Admin\no_views_text(), GravityView_Admin\plugin_action_links(), GravityView_Field_Notes\process_add_note(), GravityView_Field_Notes\process_delete_notes(), GravityView_frontend\process_search_only_approved(), GravityView_frontend\render_view(), GravityView_Admin_Views\save_postdata(), GV_License_Handler\settings_edd_license_activation(), GravityView_Admin_ApproveEntries\show_approve_entry_column(), GravityView_Support_Port\show_for_user(), GravityView_Entry_Approval\update_bulk(), and GravityView_Cache\use_cache().

static has_gravityview_shortcode (   $post = null)
static

Check whether the post is GravityView.

  • Check post type. Is it gravityview?
  • Check shortcode
Parameters
WP_Post$postWordPress post object
Returns
boolean True: yep, GravityView; No: not!

Definition at line 948 of file class-common.php.

References $post.

Referenced by has_gravityview_shortcode().

static has_product_field (   $form = array())
static

Check whether a form has product fields.

Since
1.16
Parameters
array$formGravity Forms form array
Returns
bool|GF_Field[]

Definition at line 145 of file class-common.php.

References $form.

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

Placeholder until the recursive has_shortcode() patch is merged.

See also
https://core.trac.wordpress.org/ticket/26343#comment:10
Parameters
string$contentContent to check whether there's a shortcode
string$tagCurrent shortcode tag

Definition at line 968 of file class-common.php.

References $content.

Referenced by gravityview_has_shortcode_r().

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

Checks if the field type is a 'numeric' field type (e.g.

to be used when sorting)

Parameters
int | array$formform ID or form array
int | array$fieldfield key or field array
Returns
boolean
Runs Filter:
gravityview/common/numeric_types What types of fields are numeric?
Since
1.5.2
Parameters
array$numeric_typesFields that are numeric. Default: [ number, time ]

Definition at line 1252 of file class-common.php.

References $field, $form, $gv_field, and GravityView_Fields\get().

Referenced by GravityView_frontend\updateViewSorting().

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

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
string$contentContent to encrypt
string$messageMessage shown if Javascript is disabled
See also
https://github.com/jnicol/standalone-phpenkoder StandalonePHPEnkoder on Github
Since
1.7
Returns
string Content, encrypted
Runs Filter:
gravityview/phpenkoder/msg Modify the message shown when Javascript is disabled and an encrypted email field is displayed
Since
1.7
Parameters
string$messageExisting message
string$contentContent to encrypt

Definition at line 1298 of file class-common.php.

References $content, $enkoder, $output, and GRAVITYVIEW_DIR.

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

Wrapper for the GFFormsModel::matches_operation() method that adds additional comparisons, including: 'equals', 'greater_than_or_is', 'greater_than_or_equals', 'less_than_or_is', 'less_than_or_equals', and 'not_contains'.

Since
1.13 You can define context, which displays/hides based on what's being displayed (single, multiple, edit)
See also
http://docs.gravityview.co/article/252-gvlogic-shortcode GFFormsModel::matches_operation
Since
1.7.5
Parameters
string$val1Left side of comparison
string$val2Right side of comparison
string$operationType of comparison
Returns
bool True: matches, false: not matches

Definition at line 655 of file class-common.php.

References $value, and gravityview_get_context().

Referenced by GVLogic_Shortcode\set_is_match().

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

Send email using GFCommon::send_email()

Since
1.17
See also
GFCommon::send_email This just makes the method public
Parameters
string$fromSender address (required)
string$toRecipient address (required)
string$bccBCC recipients (required)
string$reply_toReply-to address (required)
string$subjectSubject line (required)
string$messageMessage body (required)
string$from_nameDisplayed name of the sender
string$message_formatIf "html", sent text as text/html. Otherwise, text/plain. Default: "html".
string | array$attachmentsOptional. Files to attach. {
See also
wp_mail()} for usage. Default: "".
Parameters
array | false$entryGravity Forms entry array, related to the email. Default: false.
array | false$notificationGravity Forms notification that triggered the email. {
See also
GFCommon::send_notification}. Default:false.

Definition at line 1569 of file class-common.php.

References $entry.

Referenced by GravityView_Field_Notes\maybe_send_entry_notes().


The documentation for this class was generated from the following file: