Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix - Email template on email clone, save and continue forms #1275

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
= 3.0.1 - xx-xx-2024
* Enhancement - Global Setting Premium Sidebar.
* Fix - Block design all messed up when viewed in block editor.
* Fix - Wrong instruction on captcha
* Fix - Wrong instruction on captcha.
* Fix - Email template on email clone, save and continue forms.
* Tweak - Test email input and button design.

= 3.0.0.1 - 27-05-2024
Expand Down
7 changes: 4 additions & 3 deletions includes/class-evf-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
'form_migrator_forms_list' => false,
'form_migrator' => false,
'fm_dismiss_notice' => false,
'email_duplicate' => false,
'form_entry_migrator' => false,
'embed_form' => false,
'goto_edit_page' => false,
Expand Down Expand Up @@ -915,13 +916,13 @@
break;
}
/* translators: %s: from address */
$subject = 'Everest Form: ' . sprintf( esc_html__( $subject, 'everest-forms' ) );

Check failure on line 919 in includes/class-evf-ajax.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4 , WP Latest)

The $text parameter must be a single text string literal. Found: $subject
$header = "Reply-To: {{from}} \r\n";
$header .= 'Content-Type: text/html; charset=UTF-8';
$message = '<div class="everest-forms-message-text">';
$message .= '<h3 style="text-align:center; color: #ffc107;">' . esc_html( 'PS. This is just the sample data' ) . '</h3>';
$message .= '<p><strong>' . esc_html__( 'Hi there!', 'everest-forms' ) . ' 👋</strong></p>';
$message .= '<p>' . esc_html__( 'Let\'s see how your forms performed ' . $evf_summary_duration . '.', 'everest-forms' ) . '</p>';

Check failure on line 925 in includes/class-evf-ajax.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4 , WP Latest)

The $text parameter must be a single text string literal. Found: 'Let\'s see how your forms performed ' . $evf_summary_duration . '.'
$message .= '<br/>';
$message .= '<p><strong>' . esc_html__( 'Forms Stats', 'everest-forms' ) . '</strong></p>';
$message .= '<table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" style="solid #dddddd; display:block;min-width: 100%;border-collapse: collapse;width:100%; display:table; padding-bottom:2rem" class="evf_entries_summary_table">';
Expand Down Expand Up @@ -1101,7 +1102,7 @@
* Forms list for form migrator.
*
* @since 2.0.8
*/

Check failure on line 1105 in includes/class-evf-ajax.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4 , WP Latest)

Missing @throws tag in function comment
public static function form_migrator_forms_list() {
try {
check_ajax_referer( 'evf_form_migrator_forms_list_nonce', 'security' );
Expand Down Expand Up @@ -1139,7 +1140,7 @@
$forms_list_table = '<div class="evf-fm-forms-table-wrapper">';
$forms_list_table .= '<h4>' . sprintf( '%s %s', esc_html__( 'Import', 'everest-forms' ), $form_instance->name ) . '</h4>';
$forms_list_table .= '<table class="evf-fm-forms-table" data-form-slug="' . esc_attr( $form_slug ) . '">';
$forms_list_table .= '<tr class="evf-th-title"><th><input id="evf-fm-select-all" type="checkbox" name="fm_select_all_form" /></th><th>' . esc_html__( 'Form Name', 'everest-forms' ) . '</th><th>' . esc_html__( 'Imported', 'everest-forms' ) . '</th><th>' . esc_html__( 'Action' ) . '</th></tr>';

Check failure on line 1143 in includes/class-evf-ajax.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4 , WP Latest)

Missing $domain parameter in function call to esc_html__().
$hidden = '';
$imported = get_option( 'evf_fm_' . $form_slug . '_imported_form_list', array() );
foreach ( $forms_list as $form_id => $form_name ) {
Expand All @@ -1151,7 +1152,7 @@
$is_imported = false;
$imported_text = esc_html__( 'No', 'everest-forms' );
}
$forms_list_table .= '<tr id="evf-fm-row-' . esc_attr( $row ) . '" class="evf-fm-row ' . esc_attr( $hidden ) . '"><td><input class="evf-fm-select-single" type="checkbox" name="fm_select_single_form_' . esc_attr( $form_id ) . '" data-form-id="' . esc_attr( $form_id ) . '" /></td><td>' . esc_html__( $form_name, 'everest-forms' ) . '</td><td><p class="evf-fm-imported" data-form-id="' . esc_attr( $form_id ) . '">' . esc_attr( $imported_text ) . '<p></td>';

Check failure on line 1155 in includes/class-evf-ajax.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4 , WP Latest)

The $text parameter must be a single text string literal. Found: $form_name
$forms_list_table .= '<td>';
$forms_list_table .= '<div class="evf-fm-import-actions"><button class="evf-fm-import-single" data-form-id="' . esc_attr( $form_id ) . '">' . esc_html( 'Import Form' ) . '</button>';
if ( 'contact-form-7' !== $form_slug ) {
Expand All @@ -1178,7 +1179,7 @@
$forms_list_table .= '</div>';
wp_send_json_success(
array(
'message' => esc_html( 'All Forms List', 'everest-forms' ),
'message' => esc_html__( 'All Forms List', 'everest-forms' ),
'forms_list_table' => $forms_list_table,
)
);
Expand All @@ -1196,7 +1197,7 @@
* Form migrator.
*
* @since 2.0.8
*/

Check failure on line 1200 in includes/class-evf-ajax.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4 , WP Latest)

Missing @throws tag in function comment
public static function form_migrator() {
try {
check_ajax_referer( 'evf_form_migrator_nonce', 'security' );
Expand All @@ -1213,7 +1214,7 @@
$class_name = 'EVF_Fm_' . ucfirst( trim( str_replace( '-', '', $form_slug ) ) );

if ( ! class_exists( $class_name ) ) {
$except_message = sprintf( '<b><i>%s</i></b> %s', $class_name, esc_html__( 'does not exist.' ) );
$except_message = sprintf( '<b><i>%s</i></b> %s', $class_name, esc_html__( 'does not exist.', 'everest-forms' ) );
throw new Exception( $except_message );
}
// Create the instance of class.
Expand Down Expand Up @@ -1252,7 +1253,7 @@
try {
check_ajax_referer( 'evf_fm_dismiss_notice_nonce', 'security' );

$option_id = isset( $_POST['option_id'] ) ? sanitize_text_field( $_POST['option_id'] ) : '';
$option_id = isset( $_POST['option_id'] ) ? sanitize_text_field( $_POST['option_id'] ) : ''; //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash
update_option( $option_id, true );

wp_send_json_success(
Expand All @@ -1272,7 +1273,7 @@
* Form entry migrator.
*
* @since 2.0.8
*/

Check failure on line 1276 in includes/class-evf-ajax.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4 , WP Latest)

Missing @throws tag in function comment
public static function form_entry_migrator() {
try {
check_ajax_referer( 'evf_form_entry_migrator_nonce', 'security' );
Expand Down Expand Up @@ -1309,7 +1310,7 @@
$class_name = 'EVF_Fm_' . ucfirst( trim( str_replace( '-', '', $form_slug ) ) );

if ( ! class_exists( $class_name ) ) {
$except_message = sprintf( '<b><i>%s</i></b> %s', $class_name, esc_html__( 'does not exist.' ) );

Check failure on line 1313 in includes/class-evf-ajax.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4 , WP Latest)

Missing $domain parameter in function call to esc_html__().
throw new Exception( $except_message );
}
// Create the instance of class.
Expand Down
6 changes: 5 additions & 1 deletion includes/class-evf-emails.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,14 @@ public function send( $to, $subject, $message, $attachments = '', $connection_id
$message = apply_filters( 'everest_forms_entry_email__message', str_replace( '{entry_id}', absint( $this->entry_id ), $message ), $this );

// Email Template Enabled or not checked.
$email_template_included = ! empty( $this->form_data['settings']['email'][ $connection_id ]['choose_template'] ) ? true : false;
$email_template_included = ! empty( $this->form_data['settings']['email'][ $connection_id ]['choose_template'] ) ? true : false;
$save_and_continue_email_template_included = ! empty( $this->form_data['settings']['email']['connection_save_and_continue']['choose_template'] ) ? true : false;
$save_and_continue_enabled = ! empty( $this->form_data['settings']['email']['connection_save_and_continue']['enable_email_notification'] ) ? true : false;

if ( $email_template_included && true === $this->html ) {
$message = apply_filters( 'everest_forms_email_template_message', $message, $this, $connection_id );
} elseif ( ( $save_and_continue_email_template_included && true === $this->html ) && ( true === $save_and_continue_enabled ) ) {
$message = apply_filters( 'everest_forms_email_template_message', $message, $this, 'connection_save_and_continue' );
} else {
$message = $this->build_email( $message );
}
Expand Down
Loading