$dce_form_email_content_txt;
// replace single fields shorcode
$dce_form_email_content = Helper::replace_setting_shortcodes($dce_form_email_content, $fields);
if ($condition_satisfy) {
$email_sent = wp_mail($email_fields['dce_form_email_to'], $email_fields['dce_form_email_subject'], $dce_form_email_content, $headers . $cc_header . $bcc_header, $attachments);
do_action('elementor_pro/forms/mail_sent', $amail, $record);
if (!$email_sent) {
$ajax_handler->add_error_message(\ElementorPro\Modules\Forms\Classes\Ajax_Handler::get_default_message(\ElementorPro\Modules\Forms\Classes\Ajax_Handler::SERVER_ERROR, $amail));
}
}
if ($amail['dce_form_email_attachments'] && $amail['dce_form_email_attachments_delete']) {
$remove_uploaded_files = \true;
}
if (($amail['dce_form_pdf_attachments_delete'] ?? '') === 'yes') {
$remove_pdf_files = \true;
}
global $phpmailer;
if (isset($phpmailer) && $phpmailer !== NULL) {
$phpmailer->AltBody = '';
// clear the previous alt body for the next email.
}
remove_action('phpmailer_init', [$this, 'set_wp_mail_altbody']);
}
}
if ($remove_pdf_files) {
foreach ($all_pdf_attachments as $pdf_path) {
\unlink($pdf_path);
}
}
if ($remove_uploaded_files && $ajax_handler->is_success) {
if (!empty($fields) && \is_array($fields)) {
foreach ($fields as $akey => $adatas) {
$afield = Helper::get_field($akey, $settings);
if ($afield) {
if ($afield['field_type'] == 'upload') {
$files = Helper::str_to_array(',', $adatas);
if (!empty($files)) {
foreach ($files as $adata) {
if (\filter_var($adata, \FILTER_VALIDATE_URL)) {
$filename = Helper::url_to_path($adata);
if (\is_file($filename)) {
\unlink($filename);
}
}
}
}
}
}
}
}
}
}
public static function set_wp_mail_altbody($phpmailer)
{
if (isset($phpmailer) && $phpmailer !== NULL) {
$phpmailer->AltBody = self::$txt;
}
}
public function remove_attachment_tokens($dce_form_email_content, $fields)
{
$attachments_tokens = \explode(':attachment]', $dce_form_email_content);
foreach ($attachments_tokens as $akey => $avalue) {
$pieces = \explode('[form:', $avalue);
if (\count($pieces) > 2) {
$field = \end($pieces);
if (isset($fields[$field])) {
$dce_form_email_content = \str_replace('[form:' . $field . ':attachment]', '', $dce_form_email_content);
}
}
}
return $dce_form_email_content;
}
public function get_email_pdf_attachments($dce_form_email_content, $fields, $amail, $settings)
{
$attachments = array();
$pdf_attachment = '';
$pdf_form = '[form:pdf]';
$pos_pdf_token = \strpos($dce_form_email_content, $pdf_attachment);
$pos_pdf_form = \strpos($dce_form_email_content, $pdf_form);
if ($pos_pdf_token !== \false || $pos_pdf_form !== \false) {
// add PDF as attachment
global $dce_form;
if (isset($dce_form['pdf']) && isset($dce_form['pdf']['path'])) {
$pdf_path = $dce_form['pdf']['path'];
$attachments[] = $pdf_path;
}
$dce_form_email_content = \str_replace($pdf_attachment, '', $dce_form_email_content);
$dce_form_email_content = \str_replace($pdf_form, '', $dce_form_email_content);
}
$attachments_tokens = \explode(':attachment]', $dce_form_email_content);
foreach ($attachments_tokens as $akey => $avalue) {
$pieces = \explode('[form:', $avalue);
if (\count($pieces) > 1) {
$field = \end($pieces);
if (isset($fields[$field])) {
$files = Helper::str_to_array(',', $fields[$field]);
if (!empty($files)) {
foreach ($files as $adata) {
if (\filter_var($adata, \FILTER_VALIDATE_URL)) {
$file_path = Helper::url_to_path($adata);
if (\is_file($file_path)) {
if (!\in_array($file_path, $attachments)) {
$attachments[] = $file_path;
}
}
}
}
}
}
}
}
return $attachments;
}
public function get_email_upload_attachments($dce_form_email_content, $fields, $amail, $settings)
{
$attachments = [];
if ($amail['dce_form_email_attachments']) {
if (!empty($fields) && \is_array($fields)) {
foreach ($fields as $akey => $adatas) {
$afield = Helper::get_field($akey, $settings);
if ($afield) {
if ($afield['field_type'] == 'upload') {
$files = Helper::str_to_array(',', $adatas);
if (!empty($files)) {
foreach ($files as $adata) {
if (\filter_var($adata, \FILTER_VALIDATE_URL)) {
$file_path = Helper::url_to_path($adata);
if (\is_file($file_path)) {
if (!\in_array($file_path, $attachments)) {
$attachments[] = $file_path;
}
}
}
}
}
}
}
}
}
}
return $attachments;
}
/**
* @copyright Elegant Themes
* @link http://www.elegantthemes.com/
* @license GPLv2
*/
public function replace_content_shortcodes($email_content, $record, $line_break)
{
$all_fields_shortcode = '[all-fields]';
$text = $this->get_shortcode_value($all_fields_shortcode, $email_content, $record, $line_break);
$email_content = \str_replace($all_fields_shortcode, $text, $email_content);
$all_valued_fields_shortcode = '[all-fields|!empty]';
$text = $this->get_shortcode_value($all_valued_fields_shortcode, $email_content, $record, $line_break, \false);
$email_content = \str_replace($all_valued_fields_shortcode, $text, $email_content);
return $email_content;
}
/**
* @copyright Elegant Themes
* @link http://www.elegantthemes.com/
* @license GPLv2
*/
public function get_shortcode_value($shortcode, $email_content, $record, $line_break, $show_empty = \true)
{
$text = '';
if (\false !== \strpos($email_content, $shortcode)) {
foreach ($record->get('fields') as $field) {
$formatted = '';
if (!empty($field['title'])) {
$formatted = \sprintf('%s: %s', $field['title'], $field['value']);
} elseif (!empty($field['value'])) {
$formatted = \sprintf('%s', $field['value']);
}
if ('textarea' === $field['type'] && '
' === $line_break) {
$formatted = \str_replace(["\r\n", "\n", "\r"], '
', $formatted);
}
if (!$show_empty && empty($field['value'])) {
continue;
}
$text .= $formatted . $line_break;
}
}
return $text;
}
public static function add_dce_email_template_type()
{
// Add Email Template Type
$dce_email = 'Elementor\\Modules\\Library\\Documents\\Email';
\Elementor\Plugin::instance()->documents->register_document_type($dce_email::get_name_static(), \Elementor\Modules\Library\Documents\Email::get_class_full_name());
}
public function on_export($element)
{
return $element;
}
}
Fatal error: Uncaught Error: Class '\DynamicContentForElementor\Extensions\DynamicEmail' not found in /home/sportuga/public_html/wp-content/plugins/dynamic-content-for-elementor/class/extensions.php:47
Stack trace:
#0 /home/sportuga/public_html/wp-content/plugins/dynamic-content-for-elementor/class/extensions.php(17): DynamicContentForElementor\Extensions->load_extensions()
#1 /home/sportuga/public_html/wp-content/plugins/dynamic-content-for-elementor/core/plugin.php(220): DynamicContentForElementor\Extensions->__construct()
#2 /home/sportuga/public_html/wp-includes/class-wp-hook.php(324): DynamicContentForElementor\Plugin->add_dce_to_elementor('')
#3 /home/sportuga/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#4 /home/sportuga/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#5 /home/sportuga/public_html/wp-content/plugins/elementor/includes/plugin.php(658): do_action('elementor/init')
#6 /home/sportuga/public_html/wp-includes/class-wp-hook.php(324): Elementor\Plugin in /home/sportuga/public_html/wp-content/plugins/dynamic-content-for-elementor/class/extensions.php on line 47