/** * Zpracování údajů z POSTu (bez spam validace) a případné zodeslání mailu * * @author Martin Hlaváč * @link http://www.ktstudio.cz * * @param array $values * @return boolean */ protected function processMail(array $values) { if (count($values) > 0) { $firstName = htmlspecialchars(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::FIRST_NAME)); $lastName = htmlspecialchars(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::LAST_NAME)); $name = htmlspecialchars(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::NAME)); $email = htmlspecialchars(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::EMAIL)); $phone = htmlspecialchars(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::PHONE)); $message = htmlspecialchars(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::MESSAGE)); $fullName = $name ?: "{$firstName} {$lastName}"; if (KT::issetAndNotEmpty($fullName) && KT::issetAndNotEmpty($email) && KT::issetAndNotEmpty($phone) && KT::issetAndNotEmpty($message) && is_email($email)) { $ktWpInfo = new KT_WP_Info(); $requestUrl = KT::getRequestUrl(); $requestLink = "<a href=\"{$requestUrl}\">{$requestUrl}</a>"; $content = sprintf(__("Jméno: %s", "KT_CORE_DOMAIN"), $fullName) . "<br>"; $content .= sprintf(__("E-mail: %s", "KT_CORE_DOMAIN"), $email) . "<br>"; $content .= sprintf(__("Telefon: %s", "KT_CORE_DOMAIN"), $phone) . "<br><br>"; $content .= __("Zpráva:", "KT_CORE_DOMAIN") . "<br><br>{$message}<br><br>"; $content .= sprintf(__("Provedeno z URL adresy: %s", "KT_CORE_DOMAIN"), $requestLink) . "<br><br>---<br>"; $content .= sprintf($this->getEmailSignature(), $ktWpInfo->getUrl()); $contactFormEmail = apply_filters("kt_contact_form_email_filter", $this->getFormEmail()); $mailer = new KT_Mailer($contactFormEmail, $ktWpInfo->getName(), sprintf($this->getEmailTitle(), $ktWpInfo->getName())); $mailer->setReplyToEmail($email); $mailer->setContent($content); return $sendResult = $mailer->send(); } } return false; }
/** * Provede základní načtení údajů pro facebook * * @author Tomáš Kocifaj * @link http://www.ktstudio.cz * * @return \KT_WP_Facebook_Data_Configurator */ private function defaultValuesInit() { $wpModel = new KT_WP_Info(); if (KT::notIssetOrEmpty($this->getDescription())) { $this->setDescription($wpModel->getDescription()); } if (KT::notIssetOrEmpty($this->getSiteName())) { $this->setSiteName($wpModel->getName()); } if (KT::notIssetOrEmpty($this->getUrl())) { $this->setUrl($wpModel->getUrl()); } return $this; }
/** * Zpracování údajů z POSTu (bez spam validace) a případné zodeslání mailu * * @author Martin Hlaváč * @link http://www.ktstudio.cz * * @param array $values * @return boolean */ protected function processMail(array $values) { if (count($values) > 0) { $firstName = filter_var(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::FIRST_NAME), FILTER_SANITIZE_FULL_SPECIAL_CHARS); $lastName = filter_var(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::LAST_NAME), FILTER_SANITIZE_FULL_SPECIAL_CHARS); $name = filter_var(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::NAME), FILTER_SANITIZE_FULL_SPECIAL_CHARS); $email = filter_var(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::EMAIL), FILTER_SANITIZE_FULL_SPECIAL_CHARS); $phone = filter_var(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::PHONE), FILTER_SANITIZE_FULL_SPECIAL_CHARS); $message = filter_var(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::MESSAGE), FILTER_SANITIZE_FULL_SPECIAL_CHARS); $fullName = $name ?: "{$firstName} {$lastName}"; if (KT::issetAndNotEmpty($fullName) && KT::issetAndNotEmpty($email) && KT::issetAndNotEmpty($phone) && KT::issetAndNotEmpty($message) && is_email($email)) { $ktWpInfo = new KT_WP_Info(); $content = sprintf(__("Jméno: %s", KT_DOMAIN), $fullName) . "<br />"; $content .= sprintf(__("E-mail: %s", KT_DOMAIN), $email) . "<br />"; $content .= sprintf(__("Telefon: %s", KT_DOMAIN), $phone) . "<br /><br />"; $content .= sprintf(__("Zpráva:", KT_DOMAIN), $message) . "<br /><br />"; $content .= $message; $content .= "<br /><br />---<br />"; $content .= sprintf(__("Tento e-mail byl vygenerován pomocí kontaktního formuláře na webu: %s", KT_DOMAIN), $ktWpInfo->getUrl()); $contactFormEmail = apply_filters("kt_contact_form_email_filter", $this->getFormEmail()); $mailer = new KT_Mailer($contactFormEmail, $ktWpInfo->getName(), sprintf(__("%s - kontakt", KT_DOMAIN), $ktWpInfo->getName())); $mailer->setSenderEmail($email); $mailer->setSenderName($fullName); $mailer->setContent($content); return $sendResult = $mailer->send(); } } return false; }