GravityView
2.17
The best, easiest way to display Gravity Forms entries on your website.
|
If this file is called directly, abort. More...
Public Member Functions | |
__construct () | |
Initialization. More... | |
_filter_gform_custom_merge_tags ( $custom_merge_tags=array(), $form_id=0, $fields=array(), $element_id='') | |
Adds custom merge tags to merge tag options. More... | |
_filter_gform_form_settings_fields ( $fields=array(), $form=array()) | |
Filters existing GF Form Settings Fields. More... | |
_filter_gform_replace_merge_tags ( $text, $form=array(), $entry=array(), $url_encode=false, $esc_html=false) | |
Matches the merge tag in replacement text for the field. More... | |
maybe_show_approval_notice () | |
Checks page load for approval link result then maybe show notice. More... | |
maybe_update_approved () | |
Checks page load for approval link token then maybe process it. More... | |
Data Fields | |
const | DEFAULT_EXPIRATION_UNIT = 'hours' |
Default value for the expiration_unit modifier. More... | |
const | DEFAULT_EXPIRATION_VALUE = 24 |
Default value for the expiration modifier. More... | |
const | FORM_SETTINGS_KEY = 'gravityview_entry_moderation' |
const | NOTICE_URL_ARG = 'gv_approval_link_result' |
const | TOKEN_URL_ARG = 'gv_token' |
The name of the query arg used to pass token information to the approval URL. More... | |
Protected Member Functions | |
decode_token ( $token=false) | |
Decodes received token to its original form. More... | |
get_approval_status ( $action=false) | |
Returns an approval status based on the provided action. More... | |
get_link_url ( $token=false, $expiration_seconds=DAY_IN_SECONDS, $privacy='private') | |
Generates an approval link URL. More... | |
get_token ( $action=false, $expiration_timestamp=0, $privacy='private', $entry=array()) | |
Generates a JWT token based on the merge tag parameters. More... | |
is_request_valid ( $token) | |
Verifies the token. More... | |
is_token_valid (array $token) | |
Validates an approval token. More... | |
replace_merge_tag ( $matches=array(), $text='', $form=array(), $entry=array(), $url_encode=false, $esc_html=false) | |
Replaces merge tags. More... | |
update_approved ( $entry_id, $approval_status, $form_id, $scopes, $return_url) | |
Updates the entry approval status and redirects to $return_url. More... | |
Private Member Functions | |
add_hooks () | |
Adds actions and filters related to entry approval links. More... | |
If this file is called directly, abort.
Handles approval links
Definition at line 23 of file class-gravityview-entry-approval-merge-tags.php.
__construct | ( | ) |
Initialization.
Definition at line 48 of file class-gravityview-entry-approval-merge-tags.php.
References add_hooks().
_filter_gform_custom_merge_tags | ( | $custom_merge_tags = array() , |
|
$form_id = 0 , |
|||
$fields = array() , |
|||
$element_id = '' |
|||
) |
Adds custom merge tags to merge tag options.
array | $custom_merge_tags | |
int | $form_id | GF Form ID |
GF_Field[] | $fields Array of fields in the form | |
string | $element_id | The ID of the input that Merge Tags are being used on |
Definition at line 123 of file class-gravityview-entry-approval-merge-tags.php.
_filter_gform_form_settings_fields | ( | $fields = array() , |
|
$form = array() |
|||
) |
Filters existing GF Form Settings Fields.
array | $fields | Array of sections and settings fields |
array | $form | GF Form |
Definition at line 76 of file class-gravityview-entry-approval-merge-tags.php.
References gravityview().
_filter_gform_replace_merge_tags | ( | $text, | |
$form = array() , |
|||
$entry = array() , |
|||
$url_encode = false , |
|||
$esc_html = false |
|||
) |
Matches the merge tag in replacement text for the field.
string | $text | Text to replace |
array | $form | Gravity Forms form array |
array | $entry | Entry array |
bool | $url_encode | Whether to URL-encode output |
Definition at line 157 of file class-gravityview-entry-approval-merge-tags.php.
References $entry, GV\$form, gravityview(), and replace_merge_tag().
|
private |
Adds actions and filters related to entry approval links.
Definition at line 57 of file class-gravityview-entry-approval-merge-tags.php.
Referenced by __construct().
|
protected |
Decodes received token to its original form.
string | bool | $token |
string | $body_64 | $parts[0] |
string | $sig | $parts[1] |
Definition at line 560 of file class-gravityview-entry-approval-merge-tags.php.
Referenced by maybe_update_approved().
|
protected |
Returns an approval status based on the provided action.
string | bool | $action |
Definition at line 310 of file class-gravityview-entry-approval-merge-tags.php.
References GravityView_Entry_Approval_Status\get_key(), and GravityView_Entry_Approval_Status\get_values().
Referenced by get_token().
|
protected |
Generates an approval link URL.
string | bool | $token | |
string | $privacy | Approval link privacy. Accepted values are 'private' or 'public'. |
Definition at line 332 of file class-gravityview-entry-approval-merge-tags.php.
References $base_url.
Referenced by replace_merge_tag().
|
protected |
Generates a JWT token based on the merge tag parameters.
string | bool | $action | Action to be taken by the merge tag. |
int | $expiration_timestamp | Timestamp when the token expires. |
string | $privacy | Approval link privacy. Accepted values are 'private' or 'public'. |
array | $entry | Entry array. |
Definition at line 253 of file class-gravityview-entry-approval-merge-tags.php.
References $entry, and get_approval_status().
Referenced by replace_merge_tag().
|
protected |
Verifies the token.
array | $token |
Definition at line 464 of file class-gravityview-entry-approval-merge-tags.php.
References gravityview().
Referenced by maybe_update_approved().
|
protected |
Validates an approval token.
array | $token |
Definition at line 613 of file class-gravityview-entry-approval-merge-tags.php.
Referenced by maybe_update_approved().
maybe_show_approval_notice | ( | ) |
Checks page load for approval link result then maybe show notice.
Expects a $_GET request with the following $_GET keys and values:
Definition at line 510 of file class-gravityview-entry-approval-merge-tags.php.
References Utils\_GET(), GVCommon\generate_notice(), and GravityView_Entry_Approval_Status\get_label().
maybe_update_approved | ( | ) |
Checks page load for approval link token then maybe process it.
Expects a $_GET request with the following $_GET keys and values:
Definition at line 367 of file class-gravityview-entry-approval-merge-tags.php.
References $entry, $form_id, Utils\_GET(), decode_token(), gravityview(), GVCommon\has_cap(), is_request_valid(), is_token_valid(), GravityView_Entry_Approval_Status\is_valid(), and update_approved().
|
protected |
Replaces merge tags.
array | $matches | Array of Merge Tag matches found in text by preg_match_all |
string | $text | Text to replace |
array | bool | $form | Gravity Forms form array. When called inside { |
false
array | bool | $entry | Entry array. When called inside { |
false
bool | $url_encode | Whether to URL-encode output |
bool | $esc_html | Whether to apply esc_html() to output |
Definition at line 188 of file class-gravityview-entry-approval-merge-tags.php.
References $entry, GV\$form, $link, GravityView_Entry_Approval_Status\get_action(), get_link_url(), and get_token().
Referenced by _filter_gform_replace_merge_tags().
|
protected |
Updates the entry approval status and redirects to $return_url.
int | $entry_id | Entry ID. |
int | $approval_status | Approval status. |
int | $form_id | Form ID. |
array | $scopes | Token scopes to be passed to the return URL and used in { |
string | $return_url | Url to redirect to once moderation happens. |
Definition at line 654 of file class-gravityview-entry-approval-merge-tags.php.
References $form_id, and GravityView_Entry_Approval\update_approved().
Referenced by maybe_update_approved().
const DEFAULT_EXPIRATION_UNIT = 'hours' |
Default value for the expiration_unit modifier.
Definition at line 39 of file class-gravityview-entry-approval-merge-tags.php.
const DEFAULT_EXPIRATION_VALUE = 24 |
Default value for the expiration modifier.
Definition at line 34 of file class-gravityview-entry-approval-merge-tags.php.
const FORM_SETTINGS_KEY = 'gravityview_entry_moderation' |
Definition at line 41 of file class-gravityview-entry-approval-merge-tags.php.
const NOTICE_URL_ARG = 'gv_approval_link_result' |
Definition at line 43 of file class-gravityview-entry-approval-merge-tags.php.
const TOKEN_URL_ARG = 'gv_token' |
The name of the query arg used to pass token information to the approval URL.
Example: ?gv_token=eyJpYXQiOjE2NzM0ODgw[...]
Definition at line 29 of file class-gravityview-entry-approval-merge-tags.php.