Your IP : 216.73.216.98


Current Path : /home/opticamezl/www/newok/
Upload File :
Current File : /home/opticamezl/www/newok/mod_jdsimplecontactform.tar

helper.php000060400000041456151652225460006552 0ustar00<?php

/**
 * @package   JD Simple Contact Form
 * @author    JoomDev https://www.joomdev.com
 * @copyright Copyright (C) 2021 Joomdev, Inc. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
 */
// no direct access
defined('_JEXEC') or die;

class ModJDSimpleContactFormHelper {

   public static function renderForm($params, $module) {
      $fields = $params->get('fields', []);
      foreach ($fields as $field) {
         $field->id = \JFilterOutput::stringURLSafe('jdscf-' . $module->id . '-' . $field->name);
         self::renderField($field, $module, $params);
      }
   }

   public static function renderField($field, $module, $params) {
      $label = new JLayoutFile('label', JPATH_SITE . '/modules/mod_jdsimplecontactform/layouts');
      $field_layout = self::getFieldLayout($field->type);
      $input = new JLayoutFile('fields.' . $field_layout, JPATH_SITE . '/modules/mod_jdsimplecontactform/layouts');
      $layout = new JLayoutFile('field', JPATH_SITE . '/modules/mod_jdsimplecontactform/layouts');
      if ($field->type == 'checkbox' || $field->type == 'hidden') {
         $field->show_label = 0;
      }
      echo $layout->render(['field' => $field, 'label' => $label->render(['field' => $field]), 'input' => $input->render(['field' => $field, 'label' => self::getLabelText($field), 'module' => $module, 'params' => $params]), 'module' => $module]);
   }

   public static function getOptions($options) {
      $options = explode("\n", $options);
      $array = [];
      foreach ($options as $option) {
         if (!empty($option)) {
            $array[] = ['text' => $option, 'value' => trim( $option )];
         }
      }
      return $array;
   }

   public static function getLabelText($field) {
      $label = $field->label;
      if (empty($label)) {
         $label = ucfirst($field->name);
      } else {
         $label = JText::_($label);
      }
      return $label;
   }

   public static function getFieldLayout($type) {
      $return = '';
      if (file_exists(JPATH_SITE . '/modules/mod_jdsimplecontactform/layouts/fields/' . $type . '-custom.php')) {
         // For adding custom files
         $return = $type . '-custom';
      } else if (file_exists(JPATH_SITE . '/modules/mod_jdsimplecontactform/layouts/fields/' . $type . '.php')) {
         $return = $type;
      } else {
         $return = 'text';
      }
      return $return;
   }

   public static function submitForm($ajax = false) {
      if (!JSession::checkToken()) {
         throw new \Exception(JText::_("JINVALID_TOKEN"));
      }
      if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
         throw new \Exception(JText::_('MOD_JDSCF_BAD_REQUEST'), 400);
      }
      $app = JFactory::getApplication();
      $jinput = $app->input->post;

      $jdscf = $jinput->get('jdscf', [], 'ARRAY');
      $id = $jinput->get('id', [], 'INT');
      $params = self::getModuleParams();

      if ($params->get('captcha', 0)) {

         $captchaType = $params->get('captchaPlugins') == "" ? JFactory::getConfig()->get('captcha') : $params->get('captchaPlugins');
         JPluginHelper::importPlugin('captcha', $captchaType);
         $dispatcher = JEventDispatcher::getInstance();

         if ( $captchaType == "recaptcha" ) {
            $check_captcha = $dispatcher->trigger('onCheckAnswer', $jinput->get('recaptcha_response_field'));
            if (!$check_captcha[0]) {
               throw new \Exception(JText::_('Invalid Captcha'), 0);
            }
         } elseif ( $captchaType == "recaptcha_invisible" ) {
            $check_captcha = $dispatcher->trigger('onCheckAnswer', $jinput->get('g-recaptcha-response'));
         } elseif (!empty($captchaType)) {
            $check_captcha = $dispatcher->trigger('onCheckAnswer');
         }
      }

      $labels = [];
      foreach ($params->get('fields', []) as $field) {
         $labels[$field->name] = ['label' => self::getLabelText($field), 'type' => $field->type];
      }

      $cc_emails = [];
      $values = [];
      foreach ($jdscf as $name => $value) {
         if(is_array($value)) {

            // Type email values
            if(isset($value['email'])) {
               $values[$name] = $value['email'];
               
               //single cc
               if(isset($value['single_cc']) && $value['single_cc'] == 1) {
                  $cc_emails[] = $value['email'];
               }
            }
			
            // Type text values
            ( isset($value['text'] ) ? $values[$name] = $value['text'] : '');
            
            // Type number values
            ( isset($value['number'] ) ? $values[$name] = $value['number'] : '');

            // Type url values
            ( isset($value['url'] ) ? $values[$name] = $value['url'] : '');

            // Type Hidden Value
            ( isset($value['hidden'] ) ? $values[$name] = $value['hidden'] : '');

         } else {
            $values[$name] = $value;
         }
      }

      $contents = [];
      $attachments = [];
      $errors = [];
      // Get all error messages and add them to $errors variable
      $messages = $app->getMessageQueue();
      if (!empty($messages)) {
         for ($i=0; $i < count($messages); $i++) { 
            $errors[] = $messages[$i]["message"];
         }
      }
      foreach ($labels as $name => $fld) {
         $value = isset($values[$name]) ? $values[$name] : '';

         if ($fld['type'] == 'checkboxes') {
            if ( isset ($_POST['jdscf'][$name]['cbs'] ) ) {
               $value = $_POST['jdscf'][$name]['cbs'];
            }
            
            if (is_array($value)) {
               $value = implode(', ', $value);
            } else {
               $value = $value;
            }
         }        
         if ($fld['type'] == 'checkbox') {
            if (isset($_POST['jdscf'][$name]['cb'])){
               $value = $_POST['jdscf'][$name]['cb'];
            }            
            if (is_array($value)) {
               $value = implode(',', $value);
            } else {
               $value = $value;
            }
            $value = empty($value) ? 'unchecked' : 'checked';
         }

         if ($fld['type'] == 'file') {
            if(isset($_FILES['jdscf']['name'][$name])) {
               $value = $_FILES['jdscf']['name'][$name];
               $uploaded = self::uploadFile($_FILES['jdscf']['name'][$name], $_FILES['jdscf']['tmp_name'][$name]);
               //filetype error
               if(!empty($value)) {
                  if(!$uploaded) {
                     $errors[] = JText::_('MOD_JDSCF_UNSUPPORTED_FILE_ERROR');
                  }
               }               
               if(!empty($uploaded)) {
                  $attachments[] = $uploaded;
               }
            }
         }
         if ($fld['type'] == 'textarea') {
            if ($value) {
               $value = nl2br($value);
            }
         }

         $contents[] = [
             "value" => $value,
             "label" => $fld['label'],
             "name" => $name,
         ];
      }

      // Fetches IP Address of Client
      if ( $params->get('ip_info' ) ) {
         if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
            $ipAddress = $_SERVER['HTTP_CLIENT_IP'];
         }
         elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            $ipAddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
         }
         else {
            $ipAddress = $_SERVER['REMOTE_ADDR'];
         }

         $contents[] = array( 
            "value" => "<a href='http://whois.domaintools.com/$ipAddress'>$ipAddress</a>",  
            "label" => "IP Address", 
            "name" => "ip"
         );
      }

      if ($params->get('email_template', '') == 'custom') {
         $html = $params->get('email_custom', '');
         if ( empty( $html ) ) {
            $layout = new JLayoutFile('emails.default', JPATH_SITE . '/modules/mod_jdsimplecontactform/layouts');
            $html = $layout->render(['contents' => $contents]);
         } else {
            $html = self::renderVariables($contents, $html);  
         }
      } else {
         $layout = new JLayoutFile('emails.default', JPATH_SITE . '/modules/mod_jdsimplecontactform/layouts');
         $html = $layout->render(['contents' => $contents]);
      }

      // sending mail
      $mailer = JFactory::getMailer();
      $config = JFactory::getConfig();
      $title = $params->get('title', '');
      if (!empty($title)) {
         $title = ' : ' . $title;
      }
      // Sender
      if (!empty($params->get('email_from', ''))) {
         $email_from = $params->get('email_from', '');
         $email_from = self::renderVariables($contents, $email_from);
         if (!filter_var($email_from, FILTER_VALIDATE_EMAIL)) {
            $email_from = $config->get('mailfrom');
         }
      } else {
         $email_from = $config->get('mailfrom');
      }

      if (!empty($params->get('email_name', ''))) {
         $email_name = $params->get('email_name', '');
         $email_name = self::renderVariables($contents, $email_name);
         if (empty($email_name)) {
            $email_name = $config->get('fromname');
         }
      } else {
         $email_name = $config->get('fromname');
      }

      $sender = array($email_from, $email_name);
      $mailer->setSender($sender);

      // Subject
      $email_subject = !empty($params->get('email_subject', '')) ? $params->get('email_subject') : JText::_('MOD_JDSCF_DEFAULT_SUBJECT', $title);
      $email_subject = self::renderVariables($contents, $email_subject);
      $mailer->setSubject($email_subject);

      // Recipient
      $recipients = !empty($params->get('email_to', '')) ? $params->get('email_to') : $config->get('mailfrom');
      $recipients = explode(',', $recipients);
      if (!empty($recipients)) {
         $mailer->addRecipient($recipients);
      }

      // Reply-To
      if (!empty($params->get('reply_to', ''))) {
         $reply_to = $params->get('reply_to', '');
         $reply_to = self::renderVariables($contents, $reply_to);
         if (!filter_var($reply_to, FILTER_VALIDATE_EMAIL)) {
            $reply_to = '';
         }
         $mailer->addReplyTo($reply_to);
      } else {
         $reply_to = '';
      }

      // CC
      $cc = !empty($params->get('email_cc', '')) ? $params->get('email_cc') : '';
      $cc = empty($cc) ? [] : explode(",", $cc);
      if(!empty($cc_emails)){
         $cc = array_merge($cc, $cc_emails);
         $cc = array_unique($cc);
      }

      if (!empty($cc)) {
         $mailer->addCc($cc);
      }
      // BCC
      $bcc = !empty($params->get('email_bcc', '')) ? $params->get('email_bcc') : '';
      $bcc = empty($bcc) ? [] : explode(',', $bcc);
      if (!empty($bcc)) {
         $mailer->addBcc($bcc);
      }
      $mailer->isHtml(true);
      $mailer->Encoding = 'base64';
      $mailer->setBody($html);
      foreach($attachments as $attachment){
         $mailer->addAttachment($attachment);
      }
      if(!empty($errors)) {
         $app = JFactory::getApplication();
         $send = false;
         // showing all the validation errors
         foreach ($errors as $error) {
            $app->enqueueMessage(\JText::_($error), 'error');
         }
      }
      else {
         $send = $mailer->Send();
      }

      if ($send !== true) {
         switch($params->get('ajaxsubmit'))
         {
            case 0: throw new \Exception(JText::_('MOD_JDSCFEMAIL_SEND_ERROR'));
            break;
            case 1: throw new \Exception(json_encode($errors));
            break;
         }         
      }
      $message = $params->get('thankyou_message', '');
      if (empty($message)) {
         $message = JText::_('MOD_JDSCF_THANKYOU_DEFAULT');
      } else {
         $template = $params->get('email_custom', '');
         $message = self::renderVariables($contents, $message);
      }
      $redirect_url = $params->get('redirect_url', '');
      $redirect_url = self::renderVariables($contents, $redirect_url);
      if (!$ajax) {
         $return = !empty($redirect_url) ? $redirect_url : urldecode($jinput->get('returnurl', '', 'RAW'));
         $session = JFactory::getSession();
         if (empty($redirect_url)) {
            $session->set('jdscf-message-' . $id, $message);
         } else {
            $session->set('jdscf-message-' . $id, '');
         }
         $app->redirect($return);
      }
      return ['message' => $message, 'redirect' => $redirect_url, 'errors' => json_encode($errors)];
   }

   public static function renderVariables($variables, $source) {
      foreach ($variables as $content) {
         $value = is_array($content['value']) ? implode(', ', $content['value']) : $content['value'];
         $value = empty($value) ? '' : $value;
         $label = empty($content['label']) ? '' : $content['label'];
         $source = str_replace('{' . $content['name'] . ':label}', $label, $source);
         $source = str_replace('{' . $content['name'] . ':value}', $value, $source);
      }
      return $source;
   }

   public static function getModuleParams() {
      $app = JFactory::getApplication();
      $jinput = $app->input->post;
      $id = $jinput->get('id', 0);
      $params = new JRegistry();

      $db = JFactory::getDbo();
      $query = "SELECT * FROM `#__modules` WHERE `id`='$id'";
      $db->setQuery($query);
      $result = $db->loadObject();
      if (!empty($result)) {
         $params->loadString($result->params, 'JSON');
      } else {
         throw new \Exception(JText::_('MOD_JDSCF_MODULE_NOT_FOUND'), 404);
      }
      return $params;
   }

   public static function submitAjax() {
      try {
         self::submitForm();
      } catch (\Exception $e) {
         $app = JFactory::getApplication();
         $params = self::getModuleParams();
         $jinput = $app->input->post;
         $app->enqueueMessage($e->getMessage(), 'error');
         $redirect_url = $params->get('redirect_url', '');
         $return = !empty($redirect_url) ? $redirect_url : urldecode($jinput->get('returnurl', '', 'RAW'));
         $app->redirect($return);
      }
   }

   public static function submitFormAjax() {
      header('Content-Type: application/json');
      header('Access-Control-Allow-Origin: *');
      $return = array();
      try {
         $data = self::submitForm(true);
         $return['status'] = "success";
         $return['code'] = 200;
         $return['data'] = $data;
      } catch (\Exception $e) {
         $return['status'] = "error";
         $return['code'] = $e->getCode();
         $return['message'] = $e->getMessage();
         $return['line'] = $e->getLine();
         $return['file'] = $e->getFile();
      }
      echo \json_encode($return);
      exit;
   }

   public static function addJS($js, $moduleid) {
      if (!isset($GLOBALS['mod_jdscf_js_' . $moduleid])) {
         $GLOBALS['mod_jdscf_js_' . $moduleid] = [];
      }
      $GLOBALS['mod_jdscf_js_' . $moduleid][] = $js;
   }

   public static function getJS($moduleid) {
      if (!isset($GLOBALS['mod_jdscf_js_' . $moduleid])) {
         return [];
      }
      return $GLOBALS['mod_jdscf_js_' . $moduleid];
   }

   //for single email field (at bottom)
   public static function isSingleCCMail($params) {      
      $singlesendcopy_email = $params->get('single_sendcopy_email', 0);
      $singlesendcopyemail_field = $params->get('singleSendCopyEmail_field', '');      
      if($singlesendcopy_email && !empty($singlesendcopyemail_field)){
         return true;
      } else {
         return false;
      }
   }

   public static function uploadFile($name, $src) {
      jimport('joomla.filesystem.file');
      jimport('joomla.application.component.helper');

      $fullFileName = JFile::stripExt($name);
      $filetype = JFile::getExt($name);
      $filename = JFile::makeSafe($fullFileName."_".mt_rand(10000000,99999999).".".$filetype);

      $params = JComponentHelper::getParams('com_media');
      $allowable = array_map('trim', explode(',', $params->get('upload_extensions')));

      if ($filetype == '' || $filetype == false || (!in_array($filetype, $allowable) ))
      {
         return false;
      }
      else
      {
         $tmppath = JPATH_SITE . '/tmp';
         if (!file_exists($tmppath.'/jdscf')) {
            mkdir($tmppath.'/jdscf',0777);
         }
         $folder = md5(time().'-'.$filename.rand(0,99999));
         if (!file_exists($tmppath.'/jdscf/'.$folder)) {
            mkdir($tmppath.'/jdscf/'.$folder,0777);
         }
         $dest = $tmppath.'/jdscf/'.$folder.'/'.$filename;

         $return = null;
         if (JFile::upload($src, $dest)) {
            $return = $dest;
         }
         return $return;
      }
   }
}
forms/fielditem.xml000060400000013611151652225460010364 0ustar00<?xml version="1.0" encoding="UTF-8"?>
<form>
   <fieldset name="fielditem" label="MOD_JDSCF_FIELDS_LBL">
      <field
         name="name"
         type="text"
         label="MOD_JDSCF_NAME_LBL"
         description="MOD_JDSCF_NAME_DESC"
         size="45"
         pattern="^[a-zA-Z0-9_]*$"
         required="true"
      />
      <field
         name="type"
         type="list"
         required="true"
         label="MOD_JDSCF_TYPE_LBL"
         description="MOD_JDSCF_TYPE_DESC"
      >
         <option value="text">MOD_JDSCF_TYPE_TEXT_LBL</option>
         <option value="textarea">MOD_JDSCF_TYPE_TEXTAREA_LBL</option>
         <option value="radio">MOD_JDSCF_TYPE_RADIO_LBL</option>
         <option value="checkbox">MOD_JDSCF_TYPE_CHECKBOX_LBL</option>
         <option value="checkboxes">MOD_JDSCF_TYPE_CHECKBOXES_LBL</option>
         <option value="calendar">MOD_JDSCF_TYPE_CALENDAR_LBL</option>
         <option value="list">MOD_JDSCF_TYPE_LIST_LBL</option>
         <option value="email">MOD_JDSCF_TYPE_EMAIL_LBL</option>
         <option value="number">MOD_JDSCF_TYPE_NUMBER_LBL</option>
         <option value="url">MOD_JDSCF_TYPE_URL_LBL</option>
         <option value="file">MOD_JDSCF_TYPE_FILE_LBL</option>
         <option value="hidden">MOD_JDSCF_TYPE_HIDDEN_LBL</option>
      </field>
      <field
         showon="type!:hidden"
         name="show_label"
         type="radio"
         label="MOD_JDSCF_SHOW_LABEL_LBL"
         description="MOD_JDSCF_SHOW_LABEL_DESC"
         class="btn-group btn-group-yesno"
         default="1"
      >
         <option value="1">JYES</option>
         <option value="0">JNO</option>
      </field>
      <field
         showon="show_label:1"
         name="label"
         type="text"
         filter="RAW"
         label="MOD_JDSCF_LABEL_LBL"
         description="MOD_JDSCF_LABEL_DESC"
      />
      <field
         showon="type:hidden"
         name="value"
         type="text"
         filter="RAW"
         label="MOD_JDSCF_VALUE_LBL"
         description="MOD_JDSCF_VALUE_DESC"
      />
      <field
         showon="type!:hidden"
         name="required"
         type="radio"
         label="MOD_JDSCF_REQUIRED_LBL"
         description="MOD_JDSCF_REQUIRED_DESC"
         class="btn-group btn-group-yesno"
         default="0"
      >
         <option value="1">JYES</option>
         <option value="0">JNO</option>
      </field>
      <field
         showon="required:1"
         name="custom_error"
         type="text"
         label="MOD_JDSCF_CUSTOM_ERROR_LBL"
         description="MOD_JDSCF_CUSTOM_ERROR_DESC"
      />
      <field
         showon="type:list[OR]type:radio[OR]type:checkboxes"
         name="options"
         type="textarea"
         label="MOD_JDSCF_OPTIONS_LBL"
         description="MOD_JDSCF_OPTIONS_DESC"
      />
      <field
         showon="type!:hidden"
         name="width"
         type="list"
         default="12"
         label="MOD_JDSCF_WIDTH_LBL"
         description="MOD_JDSCF_WIDTH_DESC"
      >
         <option value="auto">JGLOBAL_AUTO</option>
         <option value="12">12</option>
         <option value="10">10</option>
         <option value="9">9</option>
         <option value="8">8</option>
         <option value="7">7</option>
         <option value="6">6</option>
         <option value="5">5</option>
         <option value="4">4</option>
         <option value="3">3</option>
         <option value="2">2</option>
      </field>
      <field
         showon="type:text[OR]type:textarea[OR]type:email[OR]type:number[OR]type:url[OR]type:calendar"
         name="placeholder"
         type="text"
         label="MOD_JDSCF_PLACEHOLDER_LBL"
         description="MOD_JDSCF_PLACEHOLDER_DESC"
      />
      <field
         showon="type:textarea"
         name="textarearows"
         type="number"
         default="5"
         label="MOD_JDSCF_TEXTAREA_ROWS_LBL"
         description="MOD_JDSCF_TEXTAREA_ROWS_DESC"
      />
      <field
         showon="type:text[OR]type:number"
         name="min_length"
         type="number"
         label="MOD_JDSCF_MIN_LENGTH_LBL"
         description="MOD_JDSCF_MIN_LENGTH_DESC"
      />
      <field
         showon="type:text[OR]type:number"
         name="max_length"
         type="number"
         label="MOD_JDSCF_MAX_LENGTH_LBL"
         description="MOD_JDSCF_MAX_LENGTH_DESC"
      />
      <field
         showon="type:number"
         name="min"
         type="number"
         label="MOD_JDSCF_MIN_LBL"
         description="MOD_JDSCF_MIN_DESC"
      />
      <field
         showon="type:number"
         name="max"
         type="number"
         label="MOD_JDSCF_MAX_LBL"
         description="MOD_JDSCF_MAX_DESC"
      />
      <field
         showon="type:checkboxes[OR]type:radio"
         name="optionslayout"
         type="radio"
         label="MOD_JDSCF_OPTIONS_LAYOUT_LBL"
         description="MOD_JDSCF_OPTIONS_LAYOUT_DESC"
         class="btn-group"
         default="inline"
      >
         <option value="inline">JGLOBAL_INLINE</option>
         <option value="vertical">JGLOBAL_VERTICAL</option>
      </field>
      <field
         showon="type:calendar"
         name="calendar_min"
         type="calendar"
         label="MOD_JDSCF_OPTIONS_CALENDAR_MIN_LBL"
         description="MOD_JDSCF_OPTIONS_CALENDAR_MIN_DESC"
      />
      <field
         showon="type:calendar"
         name="calendar_max"
         type="calendar"
         label="MOD_JDSCF_OPTIONS_CALENDAR_MAX_LBL"
         description="MOD_JDSCF_OPTIONS_CALENDAR_MAX_DESC"
      />
      <field
         showon="type:calendar"
         name="calendar_format"
         type="text"
         label="MOD_JDSCF_OPTIONS_CALENDAR_DATE_FOMRAT_LBL"
         description="MOD_JDSCF_OPTIONS_CALENDAR_DATE_FOMRAT_DESC"
         hint="MM-DD-YYYY"
      />
   </fieldset>
</form>forms/fieldoption.xml000060400000000417151652225460010736 0ustar00<?xml version="1.0" encoding="UTF-8"?>
<form>
   <fieldset name="fieldoption">
      <field name="text"
             label="Text"
             type="text" />
      <field name="value"
             label="Value"
             type="text" />
   </fieldset>
</form>forms/index.html000060400000000563151652225460007677 0ustar00<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
   <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
   </head>
   <body>
   </body>
</html>
layouts/emails/default.php000060400000016164151652225460011667 0ustar00<?php
/**
 * @package   JD Simple Contact Form
 * @author    JoomDev https://www.joomdev.com
 * @copyright Copyright (C) 2021 Joomdev, Inc. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
 */
// no direct access
defined('_JEXEC') or die;
extract($displayData);
?>
<!doctype html>
<html>
   <head>
      <meta name="viewport" content="width=device-width">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>Simple Transactional Email</title>
      <style>
         @media only screen and (max-width: 620px) {
            table[class=body] h1 {
               font-size: 28px !important;
               margin-bottom: 10px !important;
            }

            table[class=body] p,
            table[class=body] ul,
            table[class=body] ol,
            table[class=body] td,
            table[class=body] span,
            table[class=body] a {
               font-size: 16px !important;
            }

            table[class=body] .wrapper,
            table[class=body] .article {
               padding: 10px !important;
            }

            table[class=body] .content {
               padding: 0 !important;
            }

            table[class=body] .container {
               padding: 0 !important;
               width: 100% !important;
            }

            table[class=body] .main {
               border-left-width: 0 !important;
               border-radius: 0 !important;
               border-right-width: 0 !important;
            }

            table[class=body] .btn table {
               width: 100% !important;
            }

            table[class=body] .btn a {
               width: 100% !important;
            }

            table[class=body] .img-responsive {
               height: auto !important;
               max-width: 100% !important;
               width: auto !important;
            }
         }
         @media all {
            .ExternalClass {
               width: 100%;
            }

            .ExternalClass,
            .ExternalClass p,
            .ExternalClass span,
            .ExternalClass font,
            .ExternalClass td,
            .ExternalClass div {
               line-height: 100%;
            }

            .apple-link a {
               color: inherit !important;
               font-family: inherit !important;
               font-size: inherit !important;
               font-weight: inherit !important;
               line-height: inherit !important;
               text-decoration: none !important;
            }

            .btn-primary table td:hover {
               background-color: #34495e !important;
            }

            .btn-primary a:hover {
               background-color: #34495e !important;
               border-color: #34495e !important;
            }
         }
      </style>
   </head>
   <body class="" style="background-color: #f6f6f6; font-family: sans-serif; -webkit-font-smoothing: antialiased; font-size: 14px; line-height: 1.4; margin: 0; padding: 0; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;">
      <table role="presentation" border="0" cellpadding="0" cellspacing="0" class="body" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background-color: #f6f6f6; width: 100%;" width="100%" bgcolor="#f6f6f6">
         <tr>
            <td style="font-family: sans-serif; font-size: 14px; vertical-align: top;" valign="top">&nbsp;</td>
            <td class="container" style="font-family: sans-serif; font-size: 14px; vertical-align: top; display: block; max-width: 580px; padding: 10px; width: 580px; Margin: 0 auto;" width="580" valign="top">
               <div class="content" style="box-sizing: border-box; display: block; Margin: 0 auto; max-width: 580px; padding: 10px;">

                  <!-- START CENTERED WHITE CONTAINER -->
                  <table role="presentation" class="main" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background: #ffffff; border-radius: 3px; width: 100%;" width="100%">

                     <!-- START MAIN CONTENT AREA -->
                     <tr>
                        <td class="wrapper" style="font-family: sans-serif; font-size: 14px; vertical-align: top; box-sizing: border-box; padding: 20px;" valign="top">
                           <table role="presentation" border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;" width="100%">
                              <tr>
                                 <td style="font-family: sans-serif; font-size: 14px; vertical-align: top;" valign="top">      
                                    <table style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;" width="100%">
                                       <?php foreach ($contents as $content) { ?>
                                          <tr height="40">
                                             <td style="font-family: sans-serif; font-size: 14px; vertical-align: middle;" valign="middle"><strong><?php echo $content['label']; ?>:</strong></td>
                                             <td style="font-family: sans-serif; font-size: 14px; vertical-align: middle;" valign="middle"><?php echo is_array($content['value']) ? implode(', ', $content['value']) : $content['value']; ?></td>
                                          </tr>
                                       <?php } ?>
                                    </table>
                                 </td>
                              </tr>
                           </table>
                        </td>
                     </tr>

                     <!-- END MAIN CONTENT AREA -->
                  </table>

                  <!-- START FOOTER -->
                  <div class="footer" style="clear: both; Margin-top: 10px; text-align: center; width: 100%;">
                     <table role="presentation" border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;" width="100%">
                        <tr>
                           <td class="content-block powered-by" style="font-family: sans-serif; vertical-align: top; padding-bottom: 10px; padding-top: 10px; color: #999999; font-size: 12px; text-align: center;" valign="top" align="center">
                              Powered by <a href="https://www.joomdev.com/products/extensions/jd-simple-contact-form" style="color: #999999; font-size: 12px; text-align: center; text-decoration: none;"><?php echo JText::_('MOD_JDSIMPLECONTACTFORM'); ?></a>.
                           </td>
                        </tr>
                     </table>
                  </div>
                  <!-- END FOOTER -->

                  <!-- END CENTERED WHITE CONTAINER -->
               </div>
            </td>
            <td style="font-family: sans-serif; font-size: 14px; vertical-align: top;" valign="top">&nbsp;</td>
         </tr>
      </table>
   </body>
</html>layouts/emails/index.html000060400000000563151652225460011523 0ustar00<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
   <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
   </head>
   <body>
   </body>
</html>
layouts/field.php000060400000001202151652225460010037 0ustar00<?php

/**
 * @package   JD Simple Contact Form
 * @author    JoomDev https://www.joomdev.com
 * @copyright Copyright (C) 2021 Joomdev, Inc. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
 */
// no direct access
defined('_JEXEC') or die;
extract($displayData);
$show_label = $field->show_label === null ? 1 : $field->show_label;
if ($field->type == 'hidden') {
   echo $input;
} else {
?>
   <div class="jdscf-col-md-<?php echo $field->width; ?>">
      <div class="form-group">
         <?php echo $label; ?>
         <?php echo $input; ?>
      </div>
   </div>
<?php } ?>layouts/index.html000060400000000563151652225460010251 0ustar00<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
   <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
   </head>
   <body>
   </body>
</html>
layouts/fields/singlecc.php000060400000001416151652225460012020 0ustar00<?php
/**
 * @package   JD Simple Contact Form
 * @author    JoomDev https://www.joomdev.com
 * @copyright Copyright (C) 2021 Joomdev, Inc. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
 */
// no direct access
defined('_JEXEC') or die;
extract($displayData);
$singleCCName = $params->get('singleSendCopyEmail_field', '');
$singleCCTitle = $params->get('singleSendCopyEmailField_title', 'MOD_JDSCF_SINGLE_SEND_COPY_LBL_TITLE');
?>
<div class="form-group form-check">
    <input id="<?php echo $singleCCName; ?>" type="checkbox" name="jdscf[<?php echo $singleCCName; ?>][single_cc]" value="1" />
    <label for="<?php echo $singleCCName; ?>" class="form-check-label"><?php echo JText::_($singleCCTitle); ?></label>
</div>layouts/fields/radio.php000060400000003100151652225460011317 0ustar00<?php
/**
 * @package   JD Simple Contact Form
 * @author    JoomDev https://www.joomdev.com
 * @copyright Copyright (C) 2021 Joomdev, Inc. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
 */
// no direct access
defined('_JEXEC') or die;
extract($displayData);
$options = ModJDSimpleContactFormHelper::getOptions($field->options);
$attrs = [];
if ($field->required) {
   $attrs[] = 'required';
   if (isset($field->custom_error) && !empty(trim($field->custom_error))) {
      $attrs[] = 'data-parsley-required-message="' . JText::sprintf($field->custom_error) . '"';
   } else {
      $attrs[] = 'data-parsley-required-message="' . JText::sprintf('MOD_JDSCF_REQUIRED_ERROR', strip_tags($label)) . '"';
   }
}
$optionslayout = isset($field->optionslayout) ? $field->optionslayout : 'vertical';
?>
<?php
foreach ($options as $key => $option) {
   ?>
   <div class="form-check<?php echo $optionslayout == 'inline' ? ' form-check-inline' : ''; ?>">
      <input data-parsley-errors-container="#<?php echo $field->name; ?>-errors" class="form-check-input" type="radio" name="jdscf[<?php echo $field->name; ?>]" value="<?php echo $option['value']; ?>" id="<?php echo $field->name; ?>-<?php echo $option['value']; ?>-<?php echo $key; ?>" <?php echo implode(' ', $attrs); ?> />
      <label class="form-check-label" for="<?php echo $field->name; ?>-<?php echo $option['value']; ?>-<?php echo $key; ?>">
         <?php echo $option['text']; ?>
      </label>
   </div>
<?php }
?>
<div id="<?php echo $field->name; ?>-errors"></div>layouts/fields/list.php000060400000002045151652225460011203 0ustar00<?php
/**
 * @package   JD Simple Contact Form
 * @author    JoomDev https://www.joomdev.com
 * @copyright Copyright (C) 2021 Joomdev, Inc. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
 */
// no direct access
defined('_JEXEC') or die;
extract($displayData);
$options = ModJDSimpleContactFormHelper::getOptions($field->options);
$attrs = [];


if ($field->required) {
    $attrs[] = 'required';
    if (isset($field->custom_error) && !empty(trim($field->custom_error))) {
       $attrs[] = 'data-parsley-required-message="' . JText::sprintf($field->custom_error) . '"';
    } else {
       $attrs[] = 'data-parsley-required-message="' . JText::sprintf('MOD_JDSCF_REQUIRED_ERROR', strip_tags($label)) . '"';
    }
}
?>
<select name="jdscf[<?php echo $field->name; ?>]" class="form-control" <?php echo implode(' ', $attrs); ?>>
   <?php foreach ($options as $option) { ?>
      <option value="<?php echo $option['value']; ?>"><?php echo $option['text']; ?></option>
   <?php } ?>
</select>layouts/fields/checkbox.php000060400000002235151652225460012017 0ustar00<?php
/**
 * @package   JD Simple Contact Form
 * @author    JoomDev https://www.joomdev.com
 * @copyright Copyright (C) 2021 Joomdev, Inc. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
 */
// no direct access
defined('_JEXEC') or die;
extract($displayData);
$options = ModJDSimpleContactFormHelper::getOptions($field->options);
$attrs = [];
$attrs[] = 'id="' . $field->name . '-' . $module->id .'"';
if ($field->required) {
    $attrs[] = 'required';
    if (isset($field->custom_error) && !empty(trim($field->custom_error))) {
       $attrs[] = 'data-parsley-required-message="' . JText::sprintf($field->custom_error) . '"';
    } else {
       $attrs[] = 'data-parsley-required-message="' . JText::sprintf('MOD_JDSCF_REQUIRED_ERROR', strip_tags($label)) . '"';
    }
}
?>
<div class="form-check form-check-inline">
   <input class="form-check-input" type="checkbox" name="jdscf[<?php echo $field->name; ?>][cb]" value="1" <?php echo implode(' ', $attrs); ?> />
   <label class="form-check-label" for="<?php echo $field->name; ?>-<?php echo $module->id; ?>">
      <?php echo $label; ?>
   </label>
</div>layouts/fields/checkboxes.php000060400000003112151652225460012342 0ustar00<?php
/**
 * @package   JD Simple Contact Form
 * @author    JoomDev https://www.joomdev.com
 * @copyright Copyright (C) 2021 Joomdev, Inc. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
 */
// no direct access
defined('_JEXEC') or die;
extract($displayData);
$options = ModJDSimpleContactFormHelper::getOptions($field->options);
$attrs = [];
if ($field->required) {
   $attrs[] = 'required';
   if (isset($field->custom_error) && !empty(trim($field->custom_error))) {
      $attrs[] = 'data-parsley-required-message="' . JText::sprintf($field->custom_error) . '"';
   } else {
      $attrs[] = 'data-parsley-required-message="' . JText::sprintf('MOD_JDSCF_REQUIRED_ERROR', strip_tags($label)) . '"';
   }
}
$optionslayout = isset($field->optionslayout) ? $field->optionslayout : 'vertical';
?>
<?php
foreach ($options as $key => $option) {
   ?>
   <div class="form-check<?php echo $optionslayout == 'inline' ? ' form-check-inline' : ''; ?>">
      <input data-parsley-errors-container="#<?php echo $field->name; ?>-errors" class="form-check-input" type="checkbox" name="jdscf[<?php echo $field->name; ?>][cbs][]" value="<?php echo $option['value']; ?>" id="<?php echo $field->name; ?>-<?php echo $option['value']; ?>-<?php echo $key; ?>" <?php echo implode(' ', $attrs); ?> />
      <label class="form-check-label" for="<?php echo $field->name; ?>-<?php echo $option['value']; ?>-<?php echo $key; ?>">
         <?php echo $option['text']; ?>
      </label>
   </div>
<?php }
?>
<div id="<?php echo $field->name; ?>-errors"></div>layouts/fields/index.html000060400000000563151652225460011517 0ustar00<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
   <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
   </head>
   <body>
   </body>
</html>
layouts/fields/text.php000060400000004731151652225460011220 0ustar00<?php
/**
 * @package   JD Simple Contact Form
 * @author    JoomDev https://www.joomdev.com
 * @copyright Copyright (C) 2021 Joomdev, Inc. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
 */
// no direct access
defined('_JEXEC') or die;
extract($displayData);
$attrs = [];
$attrs[] = 'id="' . $field->id . '"';
switch ($field->type) {
   case 'email':
      $attrs[] = 'data-parsley-type="email"';
      $attrs[] = 'data-parsley-type-message="' . JText::_("MOD_JDSCF_EMAIL_REQUIRED_ERROR") . '"';
      break;
   case 'number':
      $attrs[] = 'data-parsley-type="number"';
      break;
   case 'url':
      $attrs[] = 'data-parsley-type="url"';
      break;
}
if (isset($field->placeholder) && !empty($field->placeholder)) {
   $attrs[] = 'placeholder="' . $field->placeholder . '"';
}
if ($field->type == 'text' || $field->type == 'number') {
   if (!empty($field->min_length)) {
      $attrs[] = 'data-parsley-minlength="' . $field->min_length . '"';
      $attrs[] = 'data-parsley-minlength-message="' . JText::sprintf('MOD_JDSCF_NUMBER_MIN_LENGTH_ERROR', strip_tags($label), $field->min_length) . '"';
   }
   if (!empty($field->max_length)) {
      $attrs[] = 'data-parsley-maxlength="' . $field->max_length . '"';
      $attrs[] = 'data-parsley-maxlength-message="' . JText::sprintf('MOD_JDSCF_NUMBER_MAX_LENGTH_ERROR', strip_tags($label), $field->max_length) . '"';
   }
   if ($field->type == 'number') {
      if (!empty($field->min)) {
         $attrs[] = 'data-parsley-min="' . $field->min . '"';
         $attrs[] = 'data-parsley-min-message="' . JText::sprintf('MOD_JDSCF_NUMBER_MIN_ERROR', strip_tags($label), $field->min) . '"';
      }
      if (!empty($field->max)) {
         $attrs[] = 'data-parsley-max="' . $field->max . '"';
         $attrs[] = 'data-parsley-max-message="' . JText::sprintf('MOD_JDSCF_NUMBER_MAX_ERROR', strip_tags($label), $field->max) . '"';
      }
   }
}

if ($field->required) {
   $attrs[] = 'required';
   if (isset($field->custom_error) && !empty(trim($field->custom_error))) {
      $attrs[] = 'data-parsley-required-message="' . JText::sprintf($field->custom_error) . '"';
   } else {
      $attrs[] = 'data-parsley-required-message="' . JText::sprintf('MOD_JDSCF_REQUIRED_ERROR', strip_tags($label)) . '"';
   }
}
?>
<input type="text" name="jdscf[<?php echo $field->name; ?>][<?php echo $field->type; ?>]" class="form-control" <?php echo implode(' ', $attrs); ?> />layouts/fields/file.php000060400000005675151652225460011163 0ustar00<?php
/**
 * @package   JD Simple Contact Form
 * @author    JoomDev https://www.joomdev.com
 * @copyright Copyright (C) 2021 Joomdev, Inc. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
 */
// no direct access
defined('_JEXEC') or die;
extract($displayData);
$attrs = [];
$attrs[] = 'id="' . $field->name . '-' . $module->id . '"';
if ($field->required) {
   $attrs[] = 'required';
   if (isset($field->custom_error) && !empty(trim($field->custom_error))) {
      $attrs[] = 'data-parsley-required-message="' . JText::sprintf($field->custom_error) . '"';
   } else {
      $attrs[] = 'data-parsley-required-message="' . JText::sprintf('MOD_JDSCF_REQUIRED_ERROR', strip_tags($label)) . '"';
   }
}

// fetching allowed types
$params = JComponentHelper::getParams('com_media');
$allowable = array_map('trim', explode(',', $params->get('upload_extensions')));
$allowedMaxSize = $params->get('upload_maxsize');
$document = JFactory::getDocument();
$style = '.filesize-err {'
        . 'display: none;'
        . 'margin-top: 10px;'
        . '}'
        . '.custom-file-label::after {'
        . 'content: "' . JText::sprintf('MOD_JDSCF_FILE_BTN_LBL') . '" !important;'
        . '}';
$document->addStyleDeclaration($style);
?>
<div class="custom-file">
   <input accept="<?php echo '.' . implode( ',.', $allowable ); ?>" type="file" name="jdscf[<?php echo $field->name; ?>]" class="custom-file-input" <?php echo implode(' ', $attrs); ?>>
   <label class="custom-file-label" for="<?php echo $field->name; ?>-<?php echo $module->id; ?>"><?php echo JText::_('MOD_JDSCF_FILE_LBL'); ?></label>
</div>

<div class="filesize-err filesize-error-<?php echo $field->name; ?>-<?php echo $module->id; ?> alert alert-danger alert-dismissable">
	<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
      File size is too big!
</div>


<?php
// File size validation
$js = 'var uploadField_'.$field->name.' = document.getElementById("' . $field->name . '-' .$module->id .'");';
$js .= 'uploadField_' . $field->name .'.onchange = function() {';
	$js .= 'var fileSizeBytes = this.files[0].size;';
	// $js .= 'var i = parseInt(Math.floor(Math.log(fileSizeBytes) / Math.log(1024)));';
	// $js .= 'var fileSizeMb = parseFloat(Math.round(fileSizeBytes / Math.pow(1024, i), 2));';
	$js .= 'var filesizeMb = fileSizeBytes/1024/1024;';

	$js .= 'if(filesizeMb > ' . $allowedMaxSize .'){';
		$js .= 'uploadField_'.$field->name.'.value = "";';
		$js .= 'jQuery(".filesize-error-' . $field->name . '-' . $module->id . '").show();';
	$js .= '}';
$js .= '};';

$js .= 'jQuery("#' . $field->name . '-' .$module->id . '").on("change", function() {';
    $js .= 'var fileName = jQuery(this).val().split("\\\").pop();';
    $js .= 'jQuery(this).siblings(".custom-file-label").addClass("selected").html(fileName);';
$js .= '});';

ModJDSimpleContactFormHelper::addJS($js, $module->id);
?>layouts/fields/hidden.php000060400000000765151652225460011472 0ustar00<?php
/**
 * @package   JD Simple Contact Form
 * @author    JoomDev https://www.joomdev.com
 * @copyright Copyright (C) 2021 Joomdev, Inc. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
 */
// no direct access
defined('_JEXEC') or die;
extract($displayData);
$attrs = [];
?>
<input type="hidden" name="jdscf[<?php echo $field->name; ?>][<?php echo $field->type; ?>]" value="<?php echo $field->value; ?>" <?php echo implode(' ', $attrs); ?> />layouts/fields/textarea.php000060400000002025151652225460012043 0ustar00<?php
/**
 * @package   JD Simple Contact Form
 * @author    JoomDev https://www.joomdev.com
 * @copyright Copyright (C) 2021 Joomdev, Inc. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
 */
// no direct access
defined('_JEXEC') or die;
extract($displayData);
$attrs = [];
$attrs[] = 'id="' . $field->id . '"';
if ($field->required) {
    $attrs[] = 'required';
    if (isset($field->custom_error) && !empty(trim($field->custom_error))) {
       $attrs[] = 'data-parsley-required-message="' . JText::sprintf($field->custom_error) . '"';
    } else {
       $attrs[] = 'data-parsley-required-message="' . JText::sprintf('MOD_JDSCF_REQUIRED_ERROR', strip_tags($label)) . '"';
    }
 }
if (isset($field->placeholder) && !empty($field->placeholder)) {
   $attrs[] = 'placeholder="' . $field->placeholder . '"';
}
?>
<textarea class="form-control" rows="<?php echo $field->textarearows; ?>" name="jdscf[<?php echo $field->name; ?>]" <?php echo implode(' ', $attrs); ?>></textarea>layouts/fields/submit.php000060400000001322151652225460011530 0ustar00<?php
/**
 * @package   JD Simple Contact Form
 * @author    JoomDev https://www.joomdev.com
 * @copyright Copyright (C) 2021 Joomdev, Inc. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
 */
// no direct access
defined('_JEXEC') or die;
extract($displayData);
$buttonText = $params->get('submittext', 'JSUBMIT');
$buttonClass = $params->get('submitclass', 'btn-primary');
$buttonWidth = $params->get('submit_btn_width', '12');
?>
<div class="jdscf-submit-btn jdscf-col-md-<?php echo $buttonWidth ?>">
   <button type="submit" class="btn<?php echo!empty($buttonClass) ? ' ' . $buttonClass : ''; ?> btn-block"><?php echo JText::_($buttonText); ?></button>
</div>layouts/fields/calendar.php000060400000012130151652225460011775 0ustar00<?php
/**
 * @package   JD Simple Contact Form
 * @author    JoomDev https://www.joomdev.com
 * @copyright Copyright (C) 2021 Joomdev, Inc. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
 */
// no direct access
defined('_JEXEC') or die;
extract($displayData);
$attrs = [];
$attrs[] = 'id="' . $field->id . '"';
if (isset($field->placeholder) && !empty($field->placeholder)) {
    $attrs[] = 'placeholder="' . $field->placeholder . '"';
}

if (!empty($field->id)) {
    $attrs[] = 'id="' . $field->id . '"';
}

if ($field->required) {
    $attrs[] = 'required';
    if (isset($field->custom_error) && !empty(trim($field->custom_error))) {
        $attrs[] = 'data-parsley-required-message="' . JText::sprintf($field->custom_error) . '"';
    } else {
        $attrs[] = 'data-parsley-required-message="' . JText::sprintf('MOD_JDSCF_REQUIRED_ERROR', strip_tags($label)) . '"';
    }
}

$document = JFactory::getDocument();
$style = 'label.calendar_icon {'
    . 'display: inherit;'
    . 'cursor: pointer;'
    . 'margin: 0px;'
    . 'border-radius: 0;'
    . '}';
$document->addStyleDeclaration($style);
?>

<div class="input-group mb-2">
	<input type="text" name="jdscf[<?php echo $field->name; ?>]" class="form-control" <?php echo implode(' ', $attrs); ?> autocomplete="off" />
    <label class="calendar_icon" for="<?php echo $field->id; ?>">
    	<div class="input-group-prepend">
    	  <div class="input-group-text">
    	  	<img height="16" width="16" src="data:image/svg+xml;base64,PHN2ZyBhcmlhLWhpZGRlbj0idHJ1ZSIgZm9jdXNhYmxlPSJmYWxzZSIgZGF0YS1wcmVmaXg9ImZhciIgZGF0YS1pY29uPSJjYWxlbmRhci1hbHQiIGNsYXNzPSJzdmctaW5saW5lLS1mYSBmYS1jYWxlbmRhci1hbHQgZmEtdy0xNCIgcm9sZT0iaW1nIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48cGF0aCBmaWxsPSJjdXJyZW50Q29sb3IiIGQ9Ik0xNDggMjg4aC00MGMtNi42IDAtMTItNS40LTEyLTEydi00MGMwLTYuNiA1LjQtMTIgMTItMTJoNDBjNi42IDAgMTIgNS40IDEyIDEydjQwYzAgNi42LTUuNCAxMi0xMiAxMnptMTA4LTEydi00MGMwLTYuNi01LjQtMTItMTItMTJoLTQwYy02LjYgMC0xMiA1LjQtMTIgMTJ2NDBjMCA2LjYgNS40IDEyIDEyIDEyaDQwYzYuNiAwIDEyLTUuNCAxMi0xMnptOTYgMHYtNDBjMC02LjYtNS40LTEyLTEyLTEyaC00MGMtNi42IDAtMTIgNS40LTEyIDEydjQwYzAgNi42IDUuNCAxMiAxMiAxMmg0MGM2LjYgMCAxMi01LjQgMTItMTJ6bS05NiA5NnYtNDBjMC02LjYtNS40LTEyLTEyLTEyaC00MGMtNi42IDAtMTIgNS40LTEyIDEydjQwYzAgNi42IDUuNCAxMiAxMiAxMmg0MGM2LjYgMCAxMi01LjQgMTItMTJ6bS05NiAwdi00MGMwLTYuNi01LjQtMTItMTItMTJoLTQwYy02LjYgMC0xMiA1LjQtMTIgMTJ2NDBjMCA2LjYgNS40IDEyIDEyIDEyaDQwYzYuNiAwIDEyLTUuNCAxMi0xMnptMTkyIDB2LTQwYzAtNi42LTUuNC0xMi0xMi0xMmgtNDBjLTYuNiAwLTEyIDUuNC0xMiAxMnY0MGMwIDYuNiA1LjQgMTIgMTIgMTJoNDBjNi42IDAgMTItNS40IDEyLTEyem05Ni0yNjB2MzUyYzAgMjYuNS0yMS41IDQ4LTQ4IDQ4SDQ4Yy0yNi41IDAtNDgtMjEuNS00OC00OFYxMTJjMC0yNi41IDIxLjUtNDggNDgtNDhoNDhWMTJjMC02LjYgNS40LTEyIDEyLTEyaDQwYzYuNiAwIDEyIDUuNCAxMiAxMnY1MmgxMjhWMTJjMC02LjYgNS40LTEyIDEyLTEyaDQwYzYuNiAwIDEyIDUuNCAxMiAxMnY1Mmg0OGMyNi41IDAgNDggMjEuNSA0OCA0OHptLTQ4IDM0NlYxNjBINDh2Mjk4YzAgMy4zIDIuNyA2IDYgNmgzNDBjMy4zIDAgNi0yLjcgNi02eiI+PC9wYXRoPjwvc3ZnPg==" alt="Calendar">
    	  </div>
    	</div>
    </label>
</div>

<?php

$js = 'var monthNames = [ "'. JText::_("MOD_JDSCF_JANUARY") .'", "'. JText::_("MOD_JDSCF_FEBRUARY") .'", "'. JText::_("MOD_JDSCF_MARCH") .'", "'. JText::_("MOD_JDSCF_APRIL") .'", "'. JText::_("MOD_JDSCF_MAY") .'", "'. JText::_("MOD_JDSCF_JUNE") .'", "'. JText::_("MOD_JDSCF_JULY") .'", "'. JText::_("MOD_JDSCF_AUGUST") .'", "'. JText::_("MOD_JDSCF_SEPTEMBER") .'", "'. JText::_("MOD_JDSCF_OCTOBER") .'", "'. JText::_("MOD_JDSCF_NOVEMBER") .'", "'. JText::_("MOD_JDSCF_DECEMBER") .'" ];';

$js .= 'var weekDays = [ "'. JText::_("MOD_JDSCF_SUNDAY") .'", "'. JText::_("MOD_JDSCF_MONDAY") .'", "'. JText::_("MOD_JDSCF_TUESDAY") .'", "'. JText::_("MOD_JDSCF_WEDNESDAY") .'", "'. JText::_("MOD_JDSCF_THURSDAY") .'", "'. JText::_("MOD_JDSCF_FRIDAY") .'", "'. JText::_("MOD_JDSCF_SATURDAY") .'" ];';

$js .= 'var shortWeekDays    = [ "'. JText::_("MOD_JDSCF_SUN") .'", "'. JText::_("MOD_JDSCF_MON") .'", "'. JText::_("MOD_JDSCF_TUE") .'", "'. JText::_("MOD_JDSCF_WED") .'", "'. JText::_("MOD_JDSCF_THUR") .'", "'. JText::_("MOD_JDSCF_FRI") .'", "'. JText::_("MOD_JDSCF_SAT") .'" ];';

$js .= 'var jdscf_picker_' . $module->id . ' = new Pikaday({'
. 'field: document.getElementById("' . $field->id . '")';
if (isset($field->calendar_min) && !empty($field->calendar_min) && $field->calendar_min != '0000-00-00 00:00:00') {
    $js .= ',minDate: moment("' . $field->calendar_min . '").toDate()';
}
if (isset($field->calendar_max) && !empty($field->calendar_max) && $field->calendar_max != '0000-00-00 00:00:00') {
    $js .= ',maxDate: moment("' . $field->calendar_max . '").toDate()';
}
if (isset($field->calendar_format) && !empty($field->calendar_format)) {
    $js .= ',format: "' . $field->calendar_format . '"';
} else {
    $js .= ',format: "MM-DD-YYYY"';
}
$js .= ',i18n: {';
$js .= 'months       : monthNames,';
$js .= 'weekdays     : weekDays,';
$js .= 'weekdaysShort: shortWeekDays';
$js .= '}';
$js .= ',defaultDate: moment("' . date('Y-m-d') . '").toDate(),setDefaultDate:true';
$js .= '});';

ModJDSimpleContactFormHelper::addJS($js, $module->id);
?>layouts/label.php000060400000001252151652225460010040 0ustar00<?php

/**
 * @package   JD Simple Contact Form
 * @author    JoomDev https://www.joomdev.com
 * @copyright Copyright (C) 2021 Joomdev, Inc. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
 */
// no direct access
defined('_JEXEC') or die;
extract($displayData);
$label = ModJDSimpleContactFormHelper::getLabelText($field);
$show_label = $field->show_label === null ? 1 : $field->show_label;
?>
<label for="<?php echo $field->id; ?>" class="<?php echo $show_label ? 'd-block' : 'd-none'; ?>">
   <?php echo $label; ?>
   <?php if ($field->required) { ?>
      <small class="text-danger">*</small>
   <?php } ?>
</label>fields/help.php000060400000001250151652225460007455 0ustar00<?php
/**
 * @package   JD Simple Contact Form
 * @author    JoomDev https://www.joomdev.com
 * @copyright Copyright (C) 2021 Joomdev, Inc. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
 */
// no direct access
defined('_JEXEC') or die('Restricted access');

jimport('joomla.form.formfield');

class JFormFieldHelp extends JFormField {
	
	protected $type = 'Help';

	// getLabel() left out

	public function getInput() {
		return '<a href="https://docs.joomdev.com/article/jd-simple-contact-form/" target="_blank" class="btn primary-btn"><span class="icon-question-sign" aria-hidden="true"></span> Help</a>';
	}
}mod_jdsimplecontactform.xml000060400000023301151652225460012177 0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1" client="site" method="upgrade">
   <name>mod_jdsimplecontactform</name>
   <author>JoomDev</author>
   <version>1.9</version>
   <creationDate>August 2021</creationDate>
   <url>https://www.joomdev.com</url>
   <copyright>Copyright (C) 2021 Joomdev, Inc. All rights reserved.</copyright>
   <license>GNU General Public License version 2 or later; see LICENSE.txt</license>
   <authorEmail>info@joomdev.com</authorEmail>
   <authorUrl>https://www.joomdev.com</authorUrl>
   <description>MOD_JDSIMPLECONTACTFORM_XML_DESCRIPTION</description>
   <languages folder="language">
      <language tag="en-GB">en-GB/en-GB.mod_jdsimplecontactform.ini</language>
      <language tag="en-GB">en-GB/en-GB.mod_jdsimplecontactform.sys.ini</language>
      <language tag="nl-NL">nl-NL/nl-NL.mod_jdsimplecontactform.ini</language>
      <language tag="nl-NL">nl-NL/nl-NL.mod_jdsimplecontactform.sys.ini</language>
   </languages>   
   <files>
      <filename>mod_jdsimplecontactform.xml</filename>
      <filename module="mod_jdsimplecontactform">mod_jdsimplecontactform.php</filename>
      <filename>helper.php</filename>
      <folder>tmpl</folder>
      <folder>layouts</folder>
      <folder>fields</folder>
      <folder>forms</folder>
   </files>
   <media folder="media" destination="mod_jdsimplecontactform">
      <folder>assets/css</folder>
      <folder>assets/js</folder>
   </media>
   <config>
      <fields name="params" addfieldpath="/modules/mod_jdsimplecontactform/fields/">
         <fieldset name="basic">
		 	<field name="help" type="help" default="module" label="Help" description="Click on the help button to get some help"/>
            <field
               name="title"
               type="text"
               label="MOD_JDSCF_FORM_TITLE_LBL"
               description="MOD_JDSCF_FORM_TITLE_DESC"
               filter="RAW"
            />
            <field
               name="description"
               type="textarea"
               label="MOD_JDSCF_FORM_DESCRIPTION_LBL"
               description="MOD_JDSCF_FORM_DESCRIPTION_DESC"
               filter="RAW"
            />
            <field
               name="ajaxsubmit"
               type="radio"
               label="MOD_JDSCF_AJAX_LBL"
               description="MOD_JDSCF_AJAX_DESC"
               class="btn-group btn-group-yesno"
               default="0"
            >
               <option value="1">JYES</option>
               <option value="0">JNO</option>
            </field>
            <field
               name="captcha"
               type="radio"
               label="MOD_JDSCF_CAPTCHA_LBL"
               description="MOD_JDSCF_CAPTCHA_DESC"
               class="btn-group btn-group-yesno"
               default="0"
            >
               <option value="1">JYES</option>
               <option value="0">JNO</option>
            </field>
            <field 
               name="captchaPlugins"
               type="plugins"
               label="MOD_JDSCF_CAPTCHA_TYPE_LBL"
               description="MOD_JDSCF_CAPTCHA_TYPE_DESC"
               folder="captcha"
               filter="cmd"
               useglobal="true"
               showon="params.captcha:1"
               >
		</field>
            <field
               name="submittext"
               type="text"
               default="Submit"
               label="MOD_JDSCF_FORM_SUBMIT_LBL"
               description="MOD_JDSCF_FORM_SUBMIT_DESC"
            />
            <field
               name="submitclass"
               type="text"
               label="MOD_JDSCF_SUBMITBTN_CLASS_LBL"
               description="MOD_JDSCF_SUBMITBTN_CLASS_DESC"
               default="btn-primary"
            />
            <field
               name="submit_btn_width"
               type="list"
               default="12"
               label="MOD_JDSCF_SUBMIT_WIDTH_LBL"
               description="MOD_JDSCF_SUBMIT_WIDTH_DESC"
               >
               <option value="auto">JGLOBAL_AUTO</option>
               <option value="12">12</option>
               <option value="10">10</option>
               <option value="9">9</option>
               <option value="8">8</option>
               <option value="7">7</option>
               <option value="6">6</option>
               <option value="5">5</option>
               <option value="4">4</option>
               <option value="3">3</option>
               <option value="2">2</option>
            </field>
            <field
               name="thankyou_message"
               type="editor"
               label="MOD_JDSCF_THANKYOU_MESSAGE_LBL"
               description="MOD_JDSCF_THANKYOU_MESSAGE_DESC"
               filter="safehtml"
            />
            <field
               name="redirect_url"
               type="url"
               label="MOD_JDSCF_REDIRECT_LBL"
               description="MOD_JDSCF_REDIRECT_DESC"
            />
            <field
              name="ip_info"
              type="radio"
              label="MOD_JDSCF_IPADDR_LBL"
              description="MOD_JDSCF_IPADDR_DESC"
              class="btn-group btn-group-yesno"
              default="0">
              <option value="1">JYES</option>
              <option value="0">JNO</option>
           </field>
         </fieldset>
         <fieldset name="fields" label="MOD_JDSCF_FORM_FIELDS_OPTIONS_LBL">
            <field name="fields" type="subform" formsource="modules/mod_jdsimplecontactform/forms/fielditem.xml" multiple="true" label="MOD_JDSCF_FIELDS_LBL" />
         </fieldset>
         <fieldset name="email" label="MOD_JDSCF_EMAIL_OPTIONS_LBL">
            <field
               name="email_from"
               type="text"
               label="MOD_JDSCF_EMAIL_FROM_LBL"
               description="MOD_JDSCF_EMAIL_FROM_DESC"
            />
            <field
               name="email_name"
               type="text"
               label="MOD_JDSCF_EMAIL_NAME_LBL"
               description="MOD_JDSCF_EMAIL_NAME_DESC"
            />
            <field
               name="email_subject"
               type="text"
               label="MOD_JDSCF_EMAIL_SUBJECT_LBL"
               description="MOD_JDSCF_EMAIL_SUBJECT_DESC"
            />
            <field
               name="email_to"
               type="text"
               label="MOD_JDSCF_EMAIL_TO_LBL"
               description="MOD_JDSCF_EMAIL_TO_DESC"
            />
            <field
               name="reply_to"
               type="text"
               label="MOD_JDSCF_REPLY_TO_LBL"
               description="MOD_JDSCF_REPLY_TO_DESC"
            />
            <field
               name="email_cc"
               type="text"
               label="MOD_JDSCF_EMAIL_CC_LBL"
               description="MOD_JDSCF_EMAIL_CC_DESC"
            />
            <field
               name="email_bcc"
               type="text"
               label="MOD_JDSCF_EMAIL_BCC_LBL"
               description="MOD_JDSCF_EMAIL_BCC_DESC"
            />
            <!-- For Send Copy Checkbox -->
            <field
               name="single_sendcopy_email"
               type="radio"
               label="MOD_JDSCF_SINGLE_SEND_COPY"
               description="MOD_JDSCF_SINGLE_SEND_COPY_DESCRIPTION"
               default="0"
               class="btn-group"
            >
               <option value="1">JYES</option>
               <option value="0">JNO</option>
            </field>
            <field
               showon="single_sendcopy_email:1"
               name="singleSendCopyEmail_field"
               default=""
               type="text"
               label="MOD_JDSCF_SINGLE_SEND_COPY_EMAIL_FIELD_LABEL" 
               description="MOD_JDSCF_SINGLE_SEND_COPY_EMAIL_FIELD_DESC"
            />
            <field
               showon="single_sendcopy_email:1"
               name="singleSendCopyEmailField_title"
               default=""
               type="text"
               label="MOD_JDSCF_SINGLE_SEND_COPY_LABEL" 
               description="MOD_JDSCF_SINGLE_SEND_COPY_DESC"
            />            
            <!-- Custom Email Template -->
            <field
               name="email_template"
               type="radio"
               label="MOD_JDSCF_EMAIL_TEMPLATE_LBL"
               description="MOD_JDSCF_EMAIL_TEMPLATE_DESC"
               default=""
               class="btn-group"
            >
               <option value="">JDEFAULT</option>
               <option value="custom">JGLOBAL_CUSTOM</option>
            </field>
            <field
               showon="email_template:custom"
               name="email_custom"
               type="editor"
               label="MOD_JDSCF_EMAIL_CUSTOM_TEMPLATE_LBL"
               description="MOD_JDSCF_EMAIL_CUSTOM_TEMPLATE_LBL"
               filter="safehtml"
               default=""
            />            
         </fieldset>
         <fieldset name="advanced">
            <field
               name="layout"
               type="modulelayout"
               label="JFIELD_ALT_LAYOUT_LABEL"
               description="JFIELD_ALT_MODULE_LAYOUT_DESC"
            />

            <field
               name="moduleclass_sfx"
               type="textarea"
               label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
               description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC"
               rows="3"
            />
         </fieldset>
      </fields>
   </config>
   <updateservers>
      <server type="extension" priority="1" name="mod_jdsimplecontactform">https://cdn.joomdev.com/updates/mod_jdsimplecontactform.xml</server>
   </updateservers>
</extension>
mod_jdsimplecontactform.php000060400000001507151652225460012172 0ustar00<?php

/**
 * @package   JD Simple Contact Form
 * @author    JoomDev https://www.joomdev.com
 * @copyright Copyright (C) 2021 Joomdev, Inc. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
 */
// no direct access
defined('_JEXEC') or die;

require_once dirname(__FILE__) . '/helper.php';

$document = JFactory::getDocument();
$document->addStylesheet(JURI::root() . 'media/mod_jdsimplecontactform/assets/css/style.css?v=' . $document->getMediaVersion());
$document->addStylesheet('//cdn.jsdelivr.net/npm/pikaday/css/pikaday.css');

$layout = $params->get('layout', 'default');
// Adding Module Class Suffix.
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8');
require JModuleHelper::getLayoutPath('mod_jdsimplecontactform', $layout);
tmpl/index.html000060400000000563151652225460007525 0ustar00<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
   <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
   </head>
   <body>
   </body>
</html>
tmpl/default.php000060400000026727151652225460007677 0ustar00<?php
/**
 * @package   JD Simple Contact Form
 * @author    JoomDev https://www.joomdev.com
 * @copyright Copyright (C) 2021 Joomdev, Inc. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
 */
// no direct access
defined('_JEXEC') or die;
$title = $params->get('title', '');
$description = $params->get('description', '');
$session = JFactory::getSession();
$message = $session->get('jdscf-message-' . $module->id, '');
$captcha = $params->get('captcha', 0);
//checking if single cc is enabled
$single_cc_enable = ModJDSimpleContactFormHelper::isSingleCCMail($params);
?>
<?php
if (!empty($message)) {
   echo '<div class="jd-simple-contact-form jd-simple-contact-message-' . $module->id . '">' . $message . '</div>';
   $session->set('jdscf-message-' . $module->id, '');
} else {
   ?>
   <div class="jd-simple-contact-form jd-simple-contact-message-<?php echo $module->id; ?> <?php echo $moduleclass_sfx; ?>">
      <div class="cookie-notice alert alert-info" role="alert">
         <?php echo JText::_("MOD_JDSCF_NOTICE_ON_COOKIES_DISABLED"); ?>
      </div>
      <div id="jdscf-message-<?php echo $module->id; ?>"></div>
      <div class="simple-contact-form-loader module-<?php echo $module->id; ?> d-none">
         <div class="loading"></div>
      </div>
      <div class="jd-simple-contact-form-header">
         <?php if (!empty($title)) { ?>
            <h5 class="jd-simple-contact-description-title card-title"><?php echo JText::_($title); ?></h5>
         <?php } ?>
         <?php if (!empty($description)) { ?>
            <p class="jd-simple-contact-description card-subtitle mb-2 text-muted"><?php echo JText::_($description); ?></p>
         <?php } ?>
      </div>
      <form method="POST" action="<?php echo JURI::root(); ?>index.php?option=com_ajax&module=jdsimplecontactform&format=json&method=submit" data-parsley-validate data-parsley-errors-wrapper="<ul class='text-danger list-unstyled mt-2 small'></ul>" data-parsley-error-class="border-danger" data-parsley-success-class="border-success" id="simple-contact-form-<?php echo $module->id; ?>" enctype="multipart/form-data">
         <div class="jdscf-row">
            <?php
               ModJDSimpleContactFormHelper::renderForm($params, $module);
               if($single_cc_enable) {
                  $singleCC = new JLayoutFile('fields.singlecc', JPATH_SITE . '/modules/mod_jdsimplecontactform/layouts');
                  echo $singleCC->render(['params' => $params]);
               }
               if ($captcha) {
                  $captchaType = $params->get('captchaPlugins') == "" ? JFactory::getConfig()->get('captcha') : $params->get('captchaPlugins');
                  JPluginHelper::importPlugin('captcha', $captchaType);
                  $dispatcher = JEventDispatcher::getInstance();
                  $dispatcher->trigger('onInit', 'jdscf_recaptcha_' . $module->id);
                  $plugin = JPluginHelper::getPlugin('captcha', $captchaType);
                  
                  if ( $captchaType == "recaptcha" ) {
                     // Recaptcha: I am not a robot
                     if (!empty($plugin)) {
                        $plugin_params = new JRegistry($plugin->params);
                        $attributes = [];
                        $attributes['data-theme'] = $plugin_params->get('theme2', '');
                        $attributes['data-size'] = $plugin_params->get('size', '');
                        $attributeArray = [];
                        foreach ($attributes as $attributeKey => $attributeValue) {
                           $attributeArray[] = $attributeKey . '="' . $attributeValue . '"';
                        }
                        ?>
                        <div class="jdscf-col-md-12">
                           <div class="form-group">
                              <div id="jdscf_recaptcha_<?php echo $module->id; ?>" class="g-recaptcha" data-sitekey="<?php echo $plugin_params->get('public_key', ''); ?>" <?php echo implode(' ', $attributeArray); ?>></div>
                           </div>
                        </div>
                        <?php
                     }
                  } elseif ( $captchaType == "recaptcha_invisible" ) {
                     // Invisible recaptcha
                     if (!empty($plugin)) {
                        $plugin_params = new JRegistry($plugin->params);
                     ?>
                        <div id='recaptcha' class="g-recaptcha" data-sitekey="<?php echo $plugin_params->get('public_key', ''); ?>"  data-size="invisible"></div>
                     <?php
                     }
                  } elseif ( !empty($captchaType) ) {
                     // Display captcha plugin fields
                     if (!empty($plugin)) {
                        $plugin_params = new JRegistry($plugin->params);
                        $captchaHtml = $dispatcher->trigger('onDisplay', array('jdscf_recaptcha_' . $module->id, 'jdscf_recaptcha_' . $module->id));
                        if (!empty($captchaHtml)) {
                           ?>
                           <div class="jdscf-col-md-12">
                              <div class="form-group">
                                 <?php
                                 foreach ($captchaHtml as $cHtml) {
                                    // Add captcha generated html to page
                                    echo $cHtml;
                                 }
                                 ?>
                              </div>
                           </div>
                        <?php
                        }
                     }
                  }
               }
            ?>

            <?php
               $submit = new JLayoutFile('fields.submit', JPATH_SITE . '/modules/mod_jdsimplecontactform/layouts');
               echo $submit->render(['params' => $params]);
            ?>

         </div>
         
         <input type="hidden" name="returnurl" value="<?php echo urlencode(JUri::getInstance()); ?>"/>
         <input type="hidden" name="id" value="<?php echo $module->id; ?>" />
         <?php echo JHtml::_('form.token'); ?>
      </form>
   </div>
   <script src="//code.jquery.com/jquery-3.3.1.min.js"></script>
   <script src="//parsleyjs.org/dist/parsley.min.js"></script>
   <script src="<?php echo JURI::root(); ?>media/mod_jdsimplecontactform/assets/js/moment.min.js"></script>
   <script src="//cdn.jsdelivr.net/npm/pikaday/pikaday.js"></script>
   <script>
      <?php
         foreach (ModJDSimpleContactFormHelper::getJS($module->id) as $js) {
            echo $js;
         }
      ?>
   </script>
   <script> var jQuery_3_3_1 = $.noConflict(true);</script>
   <?php if ($params->get('ajaxsubmit', 0)) { ?>
      <script>
         (function ($) {
            $(function () {
               var showMessage<?php echo $module->id; ?> = function (type, message) {
                  type = type == 'error' ? 'danger' : type;
                  var _alert = '<div class="alert alert-' + type + '"><div>' + message + '</div></div>';
                  $('#jdscf-message-<?php echo $module->id; ?>').html(_alert);
                  setTimeout(function () {
                     $('#jdscf-message-<?php echo $module->id; ?>').html('');
                  }, 3000);
                  
                  $('html, body').animate({
                     scrollTop: $('#simple-contact-form-<?php echo $module->id; ?>').offset().top - 150
                  }, 300);
               }

               // Smooth Scroll to parsley errors
               $('#simple-contact-form-<?php echo $module->id; ?>').parsley().on('field:validated', function() {
                  var errorNotice = $('ul.text-danger li');
                  if ( errorNotice.length ) {
                     $('html, body').animate({
                        scrollTop: errorNotice.offset().top - 100
                     }, 300);
                  }
               });

               $('#simple-contact-form-<?php echo $module->id; ?>').on('submit', function (e) {
                  e.preventDefault();
                  var formData = new FormData(this);
                  var _form = $(this);
                  var _id = 'simple-contact-form-<?php echo $module->id; ?>';
                  var _loading = $('.simple-contact-form-loader.module-<?php echo $module->id; ?>');
                  if (_form.parsley().isValid()) {
                     $.ajax({
                        url: '<?php echo JURI::root(); ?>index.php?option=com_ajax&module=jdsimplecontactform&format=json&method=submitForm',
                        data: formData,
                        type: 'POST',
                        beforeSend: function () {
                           _loading.removeClass('d-none');
                        },
                        cache: false,
                        contentType: false,
                        processData: false,
                        success: function (response) {
                           
                           if (response.status == 'success') {
                              $('.jd-simple-contact-message-<?php echo $module->id; ?>').html(response.data.message);
                              _loading.addClass('d-none');
                              if (response.data.redirect != '') {
                                 setTimeout(function () {
                                    window.location = response.data.redirect;
                                 }, 2000);
                              }
                           } else {
                              _loading.addClass('d-none');
                              
                              if ( response.message == "[]" ) {
                                 showMessage<?php echo $module->id; ?>("error", "<?php echo JText::_("MOD_JDSCF_UNSUPPORTED_MAIL_CLIENT_ERROR"); ?>");
                              }
                              else if(typeof response.message == "string") 
                              {
                                 showMessage<?php echo $module->id; ?>("error", response.message);
                              }
                              else 
                              {
                                 var errors = JSON.parse(response.message);

                                 for (index = 0; index < errors.length; ++index) {
                                    showMessage<?php echo $module->id; ?>("error", errors[index]);
                                 }
                              }
                           }
                        },
                        error: function (response) {
                           _loading.addClass('d-none');
                           showMessage<?php echo $module->id; ?>("error", "<?php echo JText::_("MOD_JDSCF_AJAX_ERROR_ON_SUBMIT"); ?>");
                        }
                     });
                  }
               });
            });

            // Checking for 🍪s
            function checkCookie() {
               var cookieEnabled = navigator.cookieEnabled;
               if ( !cookieEnabled ) {
                  document.cookie = "cookieforjdscf";
                  cookieEnabled = document.cookie.indexOf("cookieforjdscf") != -1;
               }
               if ( cookieEnabled == false ) {
                  $('.cookie-notice').show();
               }
            }
            checkCookie();

         })(jQuery_3_3_1);
      </script>
   <?php } ?>
<?php }
?>