Formidable Lite Email form displays character ' as &\#039;
Permalink
Does anyone know why all of a sudden when I have an enquiry form completed by a user and they type the ' character (as in I'm) it goes posted in the email result form as &\#039;
I've contacted the developer but it seems that he's stopped supporting the lite version (which was still a paid version).
I've found this code in the mailing.php file
public function send() {
$th = Core::make('helper/text');
$mh = Core::make('helper/mail');
// Set Subject
$mh->setSubject(html_entity_decode($this->prepareSubject(), ENT_QUOTES, 'UTF-8'));
// Set From
$from_name = $this->getFromName();
$from_email = $this->getFromEmail();
if (intval($this->getFromType()) != 0) {
$element = $this->getElementByID($this->getFromType());
if (is_object($element)) {
$from_name = '';
$from_email = $element->getValue();
}
}
$mh->from($from_email, html_entity_decode($from_name, ENT_QUOTES, 'UTF-8'));
$mh->replyto($from_email, $from_name);
I think it's something to do with the ENT_QUOTES -
But that only applies to the Header of the email form and not the fields below the header.
This is the code for the fields :
// Find any elements to send to.
$send = $this->getSend();
if (is_array($send) && count($send)) {
foreach ($send as $s) {
$element = $this->getElementByID($s);
if (!is_object($element)) continue;
$value = $element->getValue();
if (empty($value)) continue;
// See if it's some sort of selector
if (!$element->getProperty('options')) $sendTo[] = $value;
else {
$options = $element->getPropertyValue('options');
if (empty($options)) continue;
$selected = array();
if (is_array($value)) $selected[] = $value[0];
else $selected = $value;
foreach ($options as $option) {
if (is_array($option) && in_array($option['name'], $selected)) $sendTo[] = array($option['value'], $option['name']);
elseif (!is_array($option) && in_array($option, $selected)) $sendTo[] = $option;
}
}
But I can't find anywhere that mentions the formating.
I've contacted the developer but it seems that he's stopped supporting the lite version (which was still a paid version).
I've found this code in the mailing.php file
public function send() {
$th = Core::make('helper/text');
$mh = Core::make('helper/mail');
// Set Subject
$mh->setSubject(html_entity_decode($this->prepareSubject(), ENT_QUOTES, 'UTF-8'));
// Set From
$from_name = $this->getFromName();
$from_email = $this->getFromEmail();
if (intval($this->getFromType()) != 0) {
$element = $this->getElementByID($this->getFromType());
if (is_object($element)) {
$from_name = '';
$from_email = $element->getValue();
}
}
$mh->from($from_email, html_entity_decode($from_name, ENT_QUOTES, 'UTF-8'));
$mh->replyto($from_email, $from_name);
I think it's something to do with the ENT_QUOTES -
But that only applies to the Header of the email form and not the fields below the header.
This is the code for the fields :
// Find any elements to send to.
$send = $this->getSend();
if (is_array($send) && count($send)) {
foreach ($send as $s) {
$element = $this->getElementByID($s);
if (!is_object($element)) continue;
$value = $element->getValue();
if (empty($value)) continue;
// See if it's some sort of selector
if (!$element->getProperty('options')) $sendTo[] = $value;
else {
$options = $element->getPropertyValue('options');
if (empty($options)) continue;
$selected = array();
if (is_array($value)) $selected[] = $value[0];
else $selected = $value;
foreach ($options as $option) {
if (is_array($option) && in_array($option['name'], $selected)) $sendTo[] = array($option['value'], $option['name']);
elseif (!is_array($option) && in_array($option, $selected)) $sendTo[] = $option;
}
}
But I can't find anywhere that mentions the formating.
My web host changed the PHP to 7.4 from 7.2 and this caused the error. So I'll now be asking Siteground why this would cause the error.