$notification ) {
if ( $id == $notification_id ) {
return $notification;
}
}
return array();
}
/**
* Displays the Notification page.
*
* If the notification ID is passed, the Notification Edit page is displayed.
* Otherwise, the Notification List page is displayed.
*
* @since Unknown
* @access public
*
* @uses GFNotification::notification_edit_page()
* @uses GFNotification::notification_list_page()
*
* @return void
*/
public static function notification_page() {
$form_id = rgget( 'id' );
$notification_id = rgget( 'nid' );
if ( ! rgblank( $notification_id ) ) {
self::notification_edit_page( $form_id, $notification_id );
} else {
self::notification_list_page( $form_id );
}
}
/**
* Builds the Notification Edit page.
*
* @access public
*
* @used-by GFNotification::notification_page()
* @uses GFFormsModel::get_form_meta()
* @uses GFNotification::get_notification()
* @uses GFNotification::validate_notification
* @uses GFFormsModel::sanitize_conditional_logic()
* @uses GFFormsModel::trim_conditional_logic_values_from_element()
* @uses GFFormsModel::save_form_notifications()
* @uses GFCommon::add_message()
* @uses GFCommon::json_decode()
* @uses GFCommon::add_error_message()
* @uses GFFormSettings::page_header()
* @uses GFNotification::get_notification_ui_settings()
* @uses SCRIPT_DEBUG
* @uses GFFormsModel::get_entry_meta()
* @uses GFFormSettings::output_field_scripts()
* @uses GFFormSettings::page_footer()
*
* @param int $form_id The ID of the form that the notification belongs to
* @param int $notification_id The ID of the notification being edited
*
* @return void
*/
public static function notification_edit_page( $form_id, $notification_id ) {
if ( ! rgempty( 'gform_notification_id' ) ) {
$notification_id = rgpost( 'gform_notification_id' );
}
$form = RGFormsModel::get_form_meta( $form_id );
/**
* Filters the form to be used in the notification page
*
* @since 1.8.6
*
* @param array $form The Form Object
* @param int $notification_id The notification ID
*/
$form = gf_apply_filters( array( 'gform_form_notification_page', $form_id ), $form, $notification_id );
$notification = ! $notification_id ? array() : self::get_notification( $form, $notification_id );
// Added second condition to account for new notifications with errors as notification ID will
// Be available in $_POST but the notification has not actually been saved yet
$is_new_notification = empty( $notification_id ) || empty( $notification );
$is_valid = true;
$is_update = false;
if ( ! empty( $_POST ) ) {
check_admin_referer( 'gforms_save_notification', 'gforms_save_notification' );
// Clear out notification because it could have legacy data populated
$notification = array( 'isActive' => isset( $notification['isActive'] ) ? rgar( $notification, 'isActive' ) : true );
$notification['name'] = sanitize_text_field( rgpost( 'gform_notification_name' ) );
$notification['service'] = sanitize_text_field( rgpost( 'gform_notification_service' ) );
$notification['event'] = sanitize_text_field( rgpost( 'gform_notification_event' ) );
$notification['to'] = rgpost( 'gform_notification_to_type' ) == 'field' ? rgpost( 'gform_notification_to_field' ) : rgpost( 'gform_notification_to_email' );
$to_type = rgpost( 'gform_notification_to_type' );
if ( ! in_array( $to_type, array( 'email', 'field', 'routing', 'hidden' ) ) ) {
$to_type = 'email';
}
$notification['toType'] = $to_type;
$notification['cc'] = rgpost( 'gform_notification_cc' );
$notification['bcc'] = rgpost( 'gform_notification_bcc' );
$notification['subject'] = sanitize_text_field( rgpost( 'gform_notification_subject' ) );
$notification['message'] = rgpost( 'gform_notification_message' );
$notification['from'] = sanitize_text_field( rgpost( 'gform_notification_from' ) );
$notification['fromName'] = sanitize_text_field( rgpost( 'gform_notification_from_name' ) );
$notification['replyTo'] = rgpost( 'gform_notification_reply_to' );
$routing = ! rgempty( 'gform_routing_meta' ) ? GFCommon::json_decode( rgpost( 'gform_routing_meta' ), true ) : null;
if ( ! empty ( $routing ) ) {
$routing_logic = array( 'rules' => $routing );
$routing_logic = GFFormsModel::sanitize_conditional_logic( $routing_logic );
$notification['routing'] = $routing_logic['rules'];
}
$notification['routing'] = $routing;
$conditional_logic = ! rgempty( 'gform_conditional_logic_meta' ) ? GFCommon::json_decode( rgpost( 'gform_conditional_logic_meta' ), true ) : null;
$notification['conditionalLogic'] = GFFormsModel::sanitize_conditional_logic( $conditional_logic );
$notification['disableAutoformat'] = (bool) rgpost( 'gform_notification_disable_autoformat' );
$notification['enableAttachments'] = (bool) rgpost( 'gform_notification_attachments' );
if ( rgpost( 'save' ) ) {
$is_update = true;
if ( $is_new_notification ) {
$notification_id = uniqid();
$notification['id'] = $notification_id;
} else {
$notification['id'] = $notification_id;
}
if ( rgpost( 'gform_is_default' ) ) {
$notification['isDefault'] = true;
}
/**
* Filters the notification before it is saved
*
* @param array $notification The Notification Object.
* @param array $form The Form Object.
* @param bool $is_new_notification True if it is a new notification. False otherwise.
*
* @since 1.7
*/
$notification = gf_apply_filters( array( 'gform_pre_notification_save', $form_id ), $notification, $form, $is_new_notification );
// Validating input...
$is_valid = self::validate_notification();
/**
* Allows overriding of if the notification passes validation
*
* @param bool $is_valid True if it is valid. False otherwise.
* @param array $notification The Notification Object
* @param array $form The Form Object
*
* @since 1.9.16
*
*/
$is_valid = gf_apply_filters( array( 'gform_notification_validation', $form_id ), $is_valid, $notification, $form );
if ( $is_valid ) {
// Input valid, updating...
// Emptying notification email if it is supposed to be disabled
if ( $_POST['gform_notification_to_type'] == 'routing' ) {
$notification['to'] = '';
} else {
$notification['routing'] = null;
}
// Trim values
$notification = GFFormsModel::trim_conditional_logic_values_from_element( $notification, $form );
$form['notifications'][ $notification_id ] = $notification;
RGFormsModel::save_form_notifications( $form_id, $form['notifications'] );
}
}
}
if ( $is_update && $is_valid ) {
$url = remove_query_arg( 'nid' );
GFCommon::add_message( sprintf( esc_html__( 'Notification saved successfully. %sBack to notifications.%s', 'gravityforms' ), '', ' ' ) );
/**
* Fires an action after a notification has been saved
*
* @since 1.9.16
*
* @param array $notification The Notification Object
* @param array $form The Form Object
* @param bool $is_new_notification True if this is a new notification. False otherwise.
*/
gf_do_action( array( 'gform_post_notification_save', $form_id ), $notification, $form, $is_new_notification );
} else if ( $is_update && ! $is_valid ) {
GFCommon::add_error_message( esc_html__( 'Notification could not be updated. Please enter all required information below.', 'gravityforms' ) );
}
// Moved page header loading here so the admin messages can be set upon saving and available for the header to print out.
GFFormSettings::page_header( esc_html__( 'Notifications', 'gravityforms' ) );
$notification_ui_settings = self::get_notification_ui_settings( $notification, $is_valid );
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || isset( $_GET['gform_debug'] ) ? '' : '.min';
?>
0 ) );
?>
prepare_items();
?>
';
$ui_settings = array();
$form_id = rgget( 'id' );
$form = RGFormsModel::get_form_meta( $form_id );
$form = gf_apply_filters( array( 'gform_admin_pre_render', $form_id ), $form );
$is_valid = empty( GFCommon::$errors );
ob_start(); ?>
>
>
$service ) { ?>
>
$label ) {
?>
>
>
*
value="email" onclick="jQuery('.notification_to_container').hide(); jQuery('#gform_notification_to_email_container').show('slow');" onkeypress="jQuery('.notification_to_container').hide(); jQuery('#gform_notification_to_email_container').show('slow');" />
value="field" onclick="jQuery('.notification_to_container').hide(); jQuery('#gform_notification_to_field_container').show('slow');" onkeypress="jQuery('.notification_to_container').hide(); jQuery('#gform_notification_to_field_container').show('slow');" />
value="routing" onclick="jQuery('.notification_to_container').hide(); jQuery('#gform_notification_to_routing_container').show('slow');" onkeypress="jQuery('.notification_to_container').hide(); jQuery('#gform_notification_to_routing_container').show('slow');" />
';
}
?>
>
.
>
id, $to_field ) ?>>
>
>
';
$doc_page = 'https://docs.gravityforms.com/troubleshooting-notifications/#use-a-valid-from-address';
echo sprintf( esc_html__( 'Warning! Using a third-party email in the From Email field may prevent your notification from being delivered. It is best to use an email with the same domain as your website. %sMore details in our documentation.%s', 'gravityforms' ), '', ' ' );
echo '';
}
if ( $is_invalid_from_email ) {
?>
>
>
>
>
*
>
*
false, 'editor_class' => 'merge-tag-support mt-wp_editor mt-manual_position mt-position-right' ) );
if ( $is_invalid_message ) {
?>
/>
/>
>
/>
array(
'label' => esc_html__( 'WordPress', 'gravityforms' ),
'image' => admin_url( 'images/wordpress-logo.svg' )
)
);
/**
* Filters the list of notification services.
*
* @since 1.9.16
*
* @param array $services The services available.
*/
return gf_apply_filters( array( 'gform_notification_services' ), $services );
}
/**
* Get the notification events for the current form.
*
* @since Unknown
* @access public
*
* @param array $form The current Form Object.
*
* @return array Notification events available within the form.
*/
public static function get_notification_events( $form ) {
$notification_events = array( 'form_submission' => esc_html__( 'Form is submitted', 'gravityforms' ) );
if ( rgars( $form, 'save/enabled' ) ) {
$notification_events['form_saved'] = esc_html__( 'Form is saved', 'gravityforms' );
$notification_events['form_save_email_requested'] = esc_html__( 'Save and continue email is requested', 'gravityforms' );
}
/**
* Allow custom notification events to be added.
*
* @since Unknown
*
* @param array $notification_events The notification events.
* @param array $form The current form.
*/
return apply_filters( 'gform_notification_events', $notification_events, $form );
}
/**
* Validates notifications.
*
* @since Unknown
* @access private
*
* @uses GFNotification::is_valid_notification_to()
* @uses GFNotification::is_valid_notification_email()
*
* @return bool True if valid. Otherwise, false.
*/
private static function validate_notification() {
$is_valid = self::is_valid_notification_to() && ! rgempty( 'gform_notification_subject' ) && ! rgempty( 'gform_notification_message' );
$cc = rgpost( 'gform_notification_cc' );
if ( ! empty( $cc ) && ! self::is_valid_notification_email( $cc ) ) {
$is_valid = false;
}
$bcc = rgpost( 'gform_notification_bcc' );
if ( ! empty( $bcc ) && ! self::is_valid_notification_email( $bcc ) ) {
$is_valid = false;
}
$reply_to = rgpost( 'gform_notification_reply_to' );
if ( ! empty( $reply_to ) && ! self::is_valid_notification_email( $reply_to ) ) {
$is_valid = false;
}
$from_email = rgpost( 'gform_notification_from' );
if ( ! empty( $from_email ) && ! self::is_valid_notification_email( $from_email ) ) {
$is_valid = false;
}
return $is_valid;
}
/**
* Determines if the notification contains valid routing.
*
* @since Unknown
* @access private
*
* @uses GFCommon::json_decode()
* @uses GFNotification::is_valid_notification_email()
*
* @see GFNotification::is_valid_notification_email
*
* @return bool True if valid, Otherwise, false.
*/
private static function is_valid_routing() {
$routing = ! empty( $_POST['gform_routing_meta'] ) ? GFCommon::json_decode( stripslashes( $_POST['gform_routing_meta'] ), true ) : null;
if ( empty( $routing ) ) {
return false;
}
foreach ( $routing as $route ) {
if ( ! self::is_valid_notification_email( $route['email'] ) ) {
return false;
}
}
return true;
}
/**
* Validates email addresses within notifications.
*
* @since Unknown
* @access private
*
* @uses GFCommon::is_invalid_or_empty_email()
*
* @param $text String containing comma-separated email addresses.
*
* @return bool True if valid. Otherwise, false.
*/
private static function is_valid_notification_email( $text ) {
if ( empty( $text ) ) {
return false;
}
$emails = explode( ',', $text );
foreach ( $emails as $email ) {
$email = trim( $email );
$invalid_email = GFCommon::is_invalid_or_empty_email( $email );
// this used to be more strict; updated to match any merge-tag-like string
$invalid_variable = ! preg_match( '/^{.+}$/', $email );
if ( $invalid_email && $invalid_variable ) {
return false;
}
}
return true;
}
/**
* Validates the notification destination
*
* @since Unknown
* @access private
*
* @uses GFNotification::is_valid_routing()
* @uses GFNotification::is_valid_notification_email()
*
* @return bool $is_valid True if valid. Otherwise, false.
*/
private static function is_valid_notification_to() {
$notification_to_email = rgpost( 'gform_notification_to_email' );
$is_valid = ( rgpost( 'gform_notification_to_type' ) == 'routing' && self::is_valid_routing() )
||
( rgpost( 'gform_notification_to_type' ) == 'email' && ( self::is_valid_notification_email( $notification_to_email ) ) )
||
( rgpost( 'gform_notification_to_type' ) == 'field' && ( ! rgempty( 'gform_notification_to_field' ) ) )
|| rgpost( 'gform_notification_to_type' ) == 'hidden';
/**
* Allows overriding of the notification destination validation
*
* @since Unknown
*
* @param bool $is_valid True if valid. False, otherwise.
* @param string $gform_notification_to_type The type of destination.
* @param string $gform_notification_to_email The destination email address, if available.
* @param string $gform_notification_to_field The field that is being used for the notification, if available.
*/
return $is_valid = apply_filters( 'gform_is_valid_notification_to', $is_valid, rgpost( 'gform_notification_to_type' ), rgpost( 'gform_notification_to_email' ), rgpost( 'gform_notification_to_field' ) );
}
/**
* Checks if notification from email is using the site domain.
*
* @since 2.4.12
*
* @param string $from_email Email address to check.
*
* @return bool
*/
private static function is_site_domain_in_from( $from_email ) {
// If {admin_email} is used check email from WP settings.
if ( strpos( $from_email, '{admin_email}' ) !== false ) {
$from_email = get_bloginfo( 'admin_email' );
}
return GFCommon::email_domain_matches( $from_email );
}
/**
* Gets the first field that can be used for notification routing.
*
* @since Unknown
* @access private
*
* @uses GFNotification::get_routing_field_types()
*
* @param array $form The Form Object to search through.
*
* @return int The field ID. Returns 0 if none found.
*/
private static function get_first_routing_field( $form ) {
foreach ( $form['fields'] as $field ) {
if ( in_array( $field->get_input_type(), self::get_routing_field_types() ) ) {
return $field->id;
}
}
return 0;
}
/**
* Gets all fields that can be used for notification routing and builds dropdowns.
*
* @since Unknown
* @access private
*
* @uses \GFFormsModel::get_label()
* @uses GFNotification::get_routing_field_types()
*
* @param array $form The Form Object to search through.
* @param int $selected_field_id The currently selected field ID.
*
* @return string $str The option HTML markup.
*/
private static function get_routing_fields( $form, $selected_field_id ) {
$str = '';
foreach ( $form['fields'] as $field ) {
$field_label = RGFormsModel::get_label( $field );
if ( in_array( $field->get_input_type(), self::get_routing_field_types() ) ) {
$selected = $field->id == $selected_field_id ? "selected='selected'" : '';
$str .= "' . $field_label . ' ';
}
}
return $str;
}
/**
* Gets supported routing field types.
*
* @since Unknown
* @access public
*
* @uses GFNotification::$supported_fields()
*
* @return array $field_types Supported field types.
*/
public static function get_routing_field_types() {
/**
* Filters the field types supported by notification routing
*
* @since 1.9.6
*
* @param array GFNotification::$supported_fields Currently supported field types.
*/
$field_types = apply_filters( 'gform_routing_field_types', self::$supported_fields );
return $field_types;
}
/**
* Gets field values to be used with routing
*
* @since Unknown
* @access private
*
* @uses GFNotification::get_first_routing_field()
* @uses GFFormsModel::get_field()
*
* @param int $i The routing rule ID.
* @param array $form The Form Object.
* @param int $field_id The field ID.
* @param string $selected_value The field value of the selected item.
* @param int $max_field_length Not used. Defaults to 16.
*
* @return string $str The HTML string containing the value.
*/
private static function get_field_values( $i, $form, $field_id, $selected_value, $max_field_length = 16 ) {
if ( empty( $field_id ) ) {
$field_id = self::get_first_routing_field( $form );
}
if ( empty( $field_id ) ) {
return '';
}
$field = RGFormsModel::get_field( $form, $field_id );
$is_any_selected = false;
$str = '';
if ( ! $field ) {
return '';
}
if ( $field->type == 'post_category' && $field->displayAllCategories == true ) {
$str .= wp_dropdown_categories( array( 'class' => 'gfield_routing_select gfield_category_dropdown gfield_routing_value_dropdown', 'orderby' => 'name', 'id' => 'routing_value_' . $i, 'selected' => $selected_value, 'hierarchical' => true, 'hide_empty' => 0, 'echo' => false ) );
} elseif ( $field->choices ) {
$str .= "";
if ( $field->placeholder ) {
$str .= "" . esc_html( $field->placeholder ) . ' ';
}
foreach ( $field->choices as $choice ) {
$is_selected = $choice['value'] == $selected_value;
$selected = $is_selected ? "selected='selected'" : '';
if ( $is_selected ) {
$is_any_selected = true;
}
$str .= "' . $choice['text'] . ' ';
}
// Adding current selected field value to the list
if ( ! $is_any_selected && ! empty( $selected_value ) ) {
$str .= "" . $selected_value . ' ';
}
$str .= ' ';
} else {
// Create a text field for fields that don't have choices (i.e text, textarea, number, email, etc...)
$str = " ";
}
return $str;
}
/**
* Gets a dropdown list of available post categories
*
* @since Unknown
* @access public
*/
public static function get_post_category_values() {
$id = 'routing_value_' . rgpost( 'ruleIndex' );
$selected = rgempty( 'selectedValue' ) ? 0 : rgpost( 'selectedValue' );
$dropdown = wp_dropdown_categories( array( 'class' => 'gfield_routing_select gfield_routing_value_dropdown gfield_category_dropdown', 'orderby' => 'name', 'id' => $id, 'selected' => $selected, 'hierarchical' => true, 'hide_empty' => 0, 'echo' => false ) );
die( $dropdown );
}
/**
* Delete a form notification
*
* @since Unknown
* @access public
*
* @uses GFFormsModel::get_form_meta()
* @uses GFFormsModel::flush_current_forms()
* @uses GFFormsModel::save_form_notifications()
*
* @param int $notification_id The notification ID to delete
* @param int|array $form_id Can pass a form ID or a form object
*
* @return int|false The result from $wpdb->query deletion
*/
public static function delete_notification( $notification_id, $form_id ) {
if ( ! $form_id ) {
return false;
}
$form = ! is_array( $form_id ) ? RGFormsModel::get_form_meta( $form_id ) : $form_id;
/**
* Fires before a notification is deleted.
*
* @since Unknown
*
* @param array $form['notifications'][$notification_id] The notification being deleted.
* @param array $form The Form Object that the notification is being deleted from.
*/
do_action( 'gform_pre_notification_deleted', $form['notifications'][ $notification_id ], $form );
unset( $form['notifications'][ $notification_id ] );
// Clear Form cache so next retrieval of form meta will reflect deleted notification
RGFormsModel::flush_current_forms();
return RGFormsModel::save_form_notifications( $form['id'], $form['notifications'] );
}
/**
* Duplicates a form notification.
*
* @since Unknown
* @access public
*
* @uses GFFormsModel::get_form_meta()
* @uses GFNotification::is_unique_name()
* @uses GFFormsModel::flush_current_forms()
* @uses GFFormsModel::save_form_notifications()
*
* @param int $notification_id The notification ID to duplicate.
* @param int|array $form_id The ID of the form or Form Object that contains the notification.
*
* @return int|false The result from $wpdb->query after duplication
*/
public static function duplicate_notification( $notification_id, $form_id ) {
if ( ! $form_id ) {
return false;
}
$form = ! is_array( $form_id ) ? RGFormsModel::get_form_meta( $form_id ) : $form_id;
$new_notification = $form['notifications'][ $notification_id ];
$name = rgar( $new_notification, 'name' );
$new_id = uniqid();
$count = 2;
$new_name = $name . ' - Copy 1';
while ( ! self::is_unique_name( $new_name, $form['notifications'] ) ) {
$new_name = $name . " - Copy $count";
$count ++;
}
$new_notification['name'] = $new_name;
$new_notification['id'] = $new_id;
unset( $new_notification['isDefault'] );
if ( $new_notification['toType'] == 'hidden' ) {
$new_notification['toType'] = 'email';
}
$form['notifications'][ $new_id ] = $new_notification;
// Clear form cache so next retrieval of form meta will return duplicated notification
RGFormsModel::flush_current_forms();
return RGFormsModel::save_form_notifications( $form['id'], $form['notifications'] );
}
/**
* Checks if a notification name is unique.
*
* @since Unknown
* @access public
*
* @param string $name The name to check.
* @param array $notifications The notifications to check against.
*
* @return bool Returns true if unique. Otherwise, false.
*/
public static function is_unique_name( $name, $notifications ) {
foreach ( $notifications as $notification ) {
if ( strtolower( rgar( $notification, 'name' ) ) == strtolower( $name ) ) {
return false;
}
}
return true;
}
}
/**
* Class GFNotificationTable.
*
* Extends WP_List_Table to display the notifications list.
*
* @uses WP_List_Table
*/
class GFNotificationTable extends WP_List_Table {
/**
* Contains the Form Object.
*
* Passed when calling the class.
*
* @since Unknown
* @access public
*
* @var array
*/
public $form;
/**
* Contains the notification events for the form.
*
* Generated in the constructor based on the passed Form Object.
*
* @since Unknown
* @access public
*
* @var array
*/
public $notification_events;
/**
* Contains the notification services for the form.
*
* Generated in the constructor.
*
* @since Unknown
* @access public
*
* @var array
*/
public $notification_services;
/**
* GFNotificationTable constructor.
*
* Sets required class properties and defines the list table columns.
*
* @since Unknown
* @access public
*
* @uses GFNotification::get_notification_events()
* @uses GFNotification::get_notification_services()
* @uses GFNotificationTable::$form
* @uses GFNotificationTable::$notification_events
* @uses GFNotificationTable::$notification_services
* @uses WP_List_Table::__construct()
*
* @param array $form The Form Object to use.
*/
function __construct( $form ) {
$this->form = $form;
$this->notification_events = GFNotification::get_notification_events( $form );
$this->notification_services = GFNotification::get_notification_services();
$columns = array(
'cb' => '',
'name' => esc_html__( 'Name', 'gravityforms' ),
'subject' => esc_html__( 'Subject', 'gravityforms' ),
);
if ( count( $this->notification_events ) > 1 ) {
$columns['event'] = esc_html__( 'Event', 'gravityforms' );
}
if ( count( $this->notification_services ) > 1 ) {
$columns['service'] = esc_html__( 'Service', 'gravityforms' );
}
$this->_column_headers = array(
$columns,
array(),
array( 'name' => array( 'name', false ) ),
'name',
);
parent::__construct();
}
/**
* Prepares the list items for displaying.
*
* @since Unknown
* @access public
*
* @uses WP_List_Table::$items
* @uses GFNotificationTable::$form
*
* @return void
*/
function prepare_items() {
$this->items = $this->form['notifications'];
switch ( rgget( 'orderby' ) ) {
case 'name':
// Sort notifications alphabetically.
usort( $this->items, array( $this, 'sort_notifications' ) );
// Reverse sort.
if ( 'desc' === rgget( 'order' ) ) {
$this->items = array_reverse( $this->items );
}
break;
default:
break;
}
}
/**
* Sort notifications alphabetically.
*
* @since 2.4
* @access public
*
* @param array $a First notification to compare.
* @param array $b Second notification to compare.
*
* @return int
*/
function sort_notifications( $a = array(), $b = array() ) {
return strcasecmp( $a['name'], $b['name'] );
}
/**
* Displays the list table.
*
* @since Unknown
* @access public
*
* @uses \WP_List_Table::get_table_classes()
* @uses \WP_List_Table::print_column_headers()
* @uses \WP_List_Table::display_rows_or_placeholder()
*
* @return void
*/
function display() {
$singular = rgar( $this->_args, 'singular' );
?>
print_column_headers(); ?>
print_column_headers( false ); ?>
>
display_rows_or_placeholder(); ?>
';
echo $this->single_row_columns( $item );
echo '';
}
/**
* Gets the column headers.
*
* @since Unknown
* @access public
*
* @used-by Filter: manage_{$this->screen->id}_columns
* @uses WP_List_Table::$_column_headers
*
* @return array The column headers.
*/
function get_columns() {
return $this->_column_headers[0];
}
/**
* Defines the default values in a column.
*
* @since Unknown
* @access public
*
* @param object $item The content to display.
* @param string $column The column to apply to.
*
* @return void
*/
function column_default( $item, $column ) {
echo rgar( $item, $column );
}
/**
* Defines a checkbox column.
*
* @since Unknown
* @access public
*
* @uses GFCommon::get_base_url()
*
* @param array $item The column data.
*
* @return void
*/
function column_cb( $item ) {
if ( rgar( $item, 'isDefault' ) ) {
return;
}
$is_active = isset( $item['isActive'] ) ? $item['isActive'] : true;
?>
$item['id'] ) );
/**
* Filters the row action links.
*
* @since Unknown
*
* @param array $actions The action links.
*/
$actions = apply_filters(
'gform_notification_actions', array(
'edit' => '' . esc_html__( 'Edit', 'gravityforms' ) . ' ',
'duplicate' => '' . esc_html__( 'Duplicate', 'gravityforms' ) . ' ',
'delete' => '' . esc_html__( 'Delete', 'gravityforms' ) . ' '
)
);
if ( isset( $item['isDefault'] ) && $item['isDefault'] ) {
unset( $actions['delete'] );
}
?>
$html ) {
$divider = $key == $last_key ? '' : ' | ';
?>
notification_services;
if ( ! rgar( $notification, 'service' ) ) {
esc_html_e( 'WordPress', 'gravityforms' );
} else if ( rgar( $services, $notification['service'] ) ) {
$service = rgar( $services, $notification['service'] );
echo rgar( $service, 'label' );
} else {
esc_html_e( 'Undefined Service', 'gravityforms' );
}
}
/**
* Displays the content of the Event column.
*
* @since Unknown
* @access public
*
* @uses GFNotificationTable::$notification_events()
*
* @param array $notification The Notification Object.
*
* @return void
*/
function column_event( $notification ) {
echo rgar( $this->notification_events, rgar( $notification, 'event' ) );
}
/**
* Content to display if the form does not have any notifications.
*
* @since Unknown
* @access public
*
* @return void
*/
function no_items() {
$url = add_query_arg( array( 'nid' => 0 ) );
printf( esc_html__( "This form doesn't have any notifications. Let's go %screate one%s.", 'gravityforms' ), "", ' ' );
}
}