本文整理汇总了PHP中Language::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Language::load方法的具体用法?PHP Language::load怎么用?PHP Language::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Language
的用法示例。
在下文中一共展示了Language::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: confirm
public function confirm($order_id) {
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($order_id);
if ($order_info) {
$this->load->model('localisation/language');
$language = new Language($order_info['language_directory']);
$language->load($order_info['language_filename']);
$language->load('mail/voucher');
$voucher_query = $this->db->query("SELECT *, vtd.name AS theme FROM `" . DB_PREFIX . "voucher` v LEFT JOIN " . DB_PREFIX . "voucher_theme vt ON (v.voucher_theme_id = vt.voucher_theme_id) LEFT JOIN " . DB_PREFIX . "voucher_theme_description vtd ON (vt.voucher_theme_id = vtd.voucher_theme_id) AND vtd.language_id = '" . (int)$order_info['language_id'] . "' WHERE v.order_id = '" . (int)$order_id . "'");
foreach ($voucher_query->rows as $voucher) {
// HTML Mail
$template = new Template();
$template->data['title'] = sprintf($language->get('text_subject'), $voucher['from_name']);
$template->data['text_greeting'] = sprintf($language->get('text_greeting'), $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']));
$template->data['text_from'] = sprintf($language->get('text_from'), $voucher['from_name']);
$template->data['text_message'] = $language->get('text_message');
$template->data['text_redeem'] = sprintf($language->get('text_redeem'), $voucher['code']);
$template->data['text_footer'] = $language->get('text_footer');
if (file_exists(DIR_IMAGE . $voucher['image'])) {
$template->data['image'] = $this->config->get('config_url') . 'image/' . $voucher['image'];
} else {
$template->data['image'] = '';
}
$template->data['store_name'] = $order_info['store_name'];
$template->data['store_url'] = $order_info['store_url'];
$template->data['message'] = nl2br($voucher['message']);
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/voucher.tpl')) {
$html = $template->fetch($this->config->get('config_template') . '/template/mail/voucher.tpl');
} else {
$html = $template->fetch('default/template/mail/voucher.tpl');
}
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->hostname = $this->config->get('config_smtp_host');
$mail->username = $this->config->get('config_smtp_username');
$mail->password = $this->config->get('config_smtp_password');
$mail->port = $this->config->get('config_smtp_port');
$mail->timeout = $this->config->get('config_smtp_timeout');
$mail->setTo($voucher['to_email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender($order_info['store_name']);
$mail->setSubject(html_entity_decode(sprintf($language->get('text_subject'), $voucher['from_name']), ENT_QUOTES, 'UTF-8'));
$mail->setHtml($html);
$mail->send();
}
}
}
示例2: send
public function send($order_id)
{
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($order_id);
// If order status in the complete range create any vouchers that where in the order need to be made available.
if (in_array($order_info['order_status_id'], $this->config->get('config_complete_status'))) {
$voucher_query = $this->db->query("SELECT *, vtd.name AS theme FROM `" . DB_PREFIX . "voucher` v LEFT JOIN " . DB_PREFIX . "voucher_theme vt ON (v.voucher_theme_id = vt.voucher_theme_id) LEFT JOIN " . DB_PREFIX . "voucher_theme_description vtd ON (vt.voucher_theme_id = vtd.voucher_theme_id) AND vtd.language_id = '" . (int) $order_info['language_id'] . "' WHERE v.order_id = '" . (int) $order_info['order_id'] . "'");
if ($voucher_query->num_rows) {
// Send out any gift voucher mails
$language = new Language($order_info['language_directory']);
$language->load($order_info['language_directory']);
$language->load('mail/voucher');
foreach ($voucher_query->rows as $voucher) {
// HTML Mail
$data = array();
$data['title'] = sprintf($language->get('text_subject'), $voucher['from_name']);
$data['text_greeting'] = sprintf($language->get('text_greeting'), $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']));
$data['text_from'] = sprintf($language->get('text_from'), $voucher['from_name']);
$data['text_message'] = $language->get('text_message');
$data['text_redeem'] = sprintf($language->get('text_redeem'), $voucher['code']);
$data['text_footer'] = $language->get('text_footer');
if (is_file(DIR_IMAGE . $voucher['image'])) {
$data['image'] = $this->config->get('config_url') . 'image/' . $voucher['image'];
} else {
$data['image'] = '';
}
$data['store_name'] = $order_info['store_name'];
$data['store_url'] = $order_info['store_url'];
$data['message'] = nl2br($voucher['message']);
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/voucher.tpl')) {
$html = $this->load->view($this->config->get('config_template') . '/template/mail/voucher.tpl', $data);
} else {
$html = $this->load->view('default/template/mail/voucher.tpl', $data);
}
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
$mail->smtp_username = $this->config->get('config_mail_smtp_username');
$mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
$mail->smtp_port = $this->config->get('config_mail_smtp_port');
$mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
$mail->setTo($voucher['to_email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender(html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8'));
$mail->setSubject(html_entity_decode(sprintf($language->get('text_subject'), $voucher['from_name']), ENT_QUOTES, 'UTF-8'));
$mail->setHtml($html);
$mail->send();
}
}
}
}
示例3: index
public function index()
{
$code = '';
$this->load->model('localisation/language');
$languages = $this->model_localisation_language->getLanguages();
if (isset($this->request->cookie['language'])) {
$code = $this->request->cookie['language'];
}
// Language Detection
if (!empty($this->request->server['HTTP_ACCEPT_LANGUAGE']) && !array_key_exists($code, $languages)) {
$browser_languages = explode(',', $this->request->server['HTTP_ACCEPT_LANGUAGE']);
foreach ($browser_languages as $browser_language) {
if (array_key_exists(strtolower($browser_language), $languages)) {
$code = strtolower($browser_language);
break;
}
}
}
if (!array_key_exists($code, $languages)) {
$code = $this->config->get('config_language');
}
if (!isset($this->request->cookie['language']) || $this->request->cookie['language'] != $code) {
setcookie('language', $code, time() + 60 * 60 * 24 * 30, '/', $this->request->server['HTTP_HOST']);
}
// Overwrite the default language object
$language = new Language($code);
$language->load($code);
$this->registry->set('language', $language);
// Set the config language_id
$this->config->set('config_language_id', $languages[$code]['language_id']);
}
示例4: editOrder
public function editOrder($order_id, $data)
{
$this->db->query("UPDATE `" . DB_PREFIX . "order` SET order_status_id = '" . (int) $data['order_status_id'] . "', date_modified = NOW() WHERE order_id = '" . (int) $order_id . "'");
$this->db->query("INSERT INTO " . DB_PREFIX . "order_history SET order_id = '" . (int) $order_id . "', order_status_id = '" . (int) $data['order_status_id'] . "', notify = '" . (isset($data['notify']) ? (int) $data['notify'] : 0) . "', comment = '" . $this->db->escape(strip_tags($data['comment'])) . "', date_added = NOW()");
if (isset($data['notify'])) {
$query = $this->db->query("SELECT *, os.name AS status, l.code AS language FROM `" . DB_PREFIX . "order` o LEFT JOIN " . DB_PREFIX . "order_status os ON (o.order_status_id = os.order_status_id AND os.language_id = o.language_id) LEFT JOIN " . DB_PREFIX . "language l ON (o.language_id = l.language_id) WHERE o.order_id = '" . (int) $order_id . "'");
if ($query->num_rows) {
$language = new Language($query->row['language']);
$language->load('customer/order');
$subject = sprintf($language->get('mail_subject'), html_entity_decode($this->config->get('config_store'), ENT_QUOTES, 'UTF-8'), $order_id);
$message = $language->get('mail_order') . ' ' . $order_id . "\n";
$message .= $language->get('mail_date_added') . ' ' . date($language->get('date_format_short'), strtotime($query->row['date_added'])) . "\n\n";
$message .= $language->get('mail_order_status') . "\n\n";
$message .= $query->row['status'] . "\n\n";
$message .= $language->get('mail_invoice') . "\n";
$message .= html_entity_decode(HTTP_CATALOG . 'index.php?route=account/invoice&order_id=' . $order_id, ENT_QUOTES, 'UTF-8') . "\n\n";
if (isset($data['comment'])) {
$message .= $language->get('mail_comment') . "\n\n";
$message .= strip_tags(html_entity_decode($data['comment'], ENT_QUOTES, 'UTF-8')) . "\n\n";
}
$message .= $language->get('mail_footer');
$mail = new Mail($this->config->get('config_mail_protocol'), $this->config->get('config_smtp_host'), $this->config->get('config_smtp_username'), html_entity_decode($this->config->get('config_smtp_password'), ENT_QUOTES, 'UTF-8'), $this->config->get('config_smtp_port'), $this->config->get('config_smtp_timeout'));
$mail->setTo($query->row['email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender(html_entity_decode($this->config->get('config_store'), ENT_QUOTES, 'UTF-8'));
$mail->setSubject($subject);
$mail->setText($message);
$mail->send();
}
}
}
示例5: index
public function index()
{
if (!isset($this->session->data['language'])) {
$languages = glob(DIR_LANGUAGE . '*', GLOB_ONLYDIR);
foreach ($languages as $language) {
$languages[] = basename($language);
}
if (isset($this->request->server['HTTP_ACCEPT_LANGUAGE'])) {
$browser_languages = explode(',', $this->request->server['HTTP_ACCEPT_LANGUAGE']);
foreach ($browser_languages as $browser_language) {
if (in_array($browser_language, $languages)) {
$this->session->data['language'] = $browser_language;
break;
}
}
}
}
if (!isset($this->session->data['language']) || !is_dir(DIR_LANGUAGE . str_replace('../', '/', $this->session->data['language']))) {
$this->session->data['language'] = $this->config->get('language.default');
}
// Language
$language = new Language($this->session->data['language']);
$language->load($this->session->data['language']);
$this->registry->set('language', $language);
}
示例6: __construct
/**
* StopWords constructor - load stop words for current locale
*
* @todo specify locale to constructor, will require shift away from defined constant
*/
public function __construct()
{
if (!defined('_XMF_STOPWORDS')) {
Language::load('stopwords');
}
if (defined('_XMF_STOPWORDS')) {
$sw = explode(' ', _XMF_STOPWORDS);
$this->stopwordList = array_fill_keys($sw, true);
}
}
示例7: confirm
public function confirm($order_id)
{
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($order_id);
if ($order_info) {
$this->load->model('localisation/language');
$language = new Language($order_info['language_directory']);
$language->load('default');
$language->load('mail/voucher');
$voucher_query = $this->db->query("SELECT v.voucher_id, v.code, v.from_name, v.from_email, v.to_name, v.to_email, v.`voucher_theme_id`, v.`message`, v.`amount`, v.`status`, v.`date_added`, vtd.name AS theme FROM `" . DB_PREFIX . "voucher` v LEFT JOIN " . DB_PREFIX . "voucher_theme vt ON (v.voucher_theme_id = vt.voucher_theme_id) LEFT JOIN " . DB_PREFIX . "voucher_theme_description vtd ON (vt.voucher_theme_id = vtd.voucher_theme_id) AND vtd.language_id = '" . (int) $order_info['language_id'] . "' WHERE v.order_id = '" . (int) $order_id . "'");
foreach ($voucher_query->rows as $voucher) {
// HTML Mail
$data = array();
$data['title'] = sprintf($language->get('text_subject'), $voucher['from_name']);
$data['text_greeting'] = sprintf($language->get('text_greeting'), $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']));
$data['text_from'] = sprintf($language->get('text_from'), $voucher['from_name']);
$data['text_message'] = $language->get('text_message');
$data['text_redeem'] = sprintf($language->get('text_redeem'), $voucher['code']);
$data['text_footer'] = $language->get('text_footer');
if (is_file(DIR_IMAGE . $voucher['image'])) {
$data['image'] = $this->config->get('config_url') . 'image/' . $voucher['image'];
} else {
$data['image'] = '';
}
$data['store_name'] = $order_info['store_name'];
$data['store_url'] = $order_info['store_url'];
$data['message'] = nl2br($voucher['message']);
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/voucher.tpl')) {
$html = $this->load->view($this->config->get('config_template') . '/template/mail/voucher.tpl', $data);
} else {
$html = $this->load->view('default/template/mail/voucher.tpl', $data);
}
$mail = new Mail($this->config->get('config_mail'));
$mail->setTo($voucher['to_email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender($order_info['store_name']);
$mail->setSubject(sprintf($language->get('text_subject'), $voucher['from_name']));
$mail->setHtml($html);
$mail->send();
}
}
}
示例8: testLoad
/**
* @covers Xmf\Language::load
*/
public function testLoad()
{
$str = '_user';
$x = Language::load($str);
if (isset($GLOBALS['xoopsConfig']['language'])) {
$language = $GLOBALS['xoopsConfig']['language'];
$this->assertSame($str, $x);
} else {
$this->assertSame(true, $x);
}
}
示例9: index
public function index()
{
// Language
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "language` WHERE code = '" . $this->db->escape($this->config->get('config_admin_language')) . "'");
if ($query->num_rows) {
$this->config->set('config_language_id', $query->row['language_id']);
}
// Language
$language = new Language($this->config->get('config_admin_language'));
$language->load($this->config->get('config_admin_language'));
$this->registry->set('language', $language);
}
示例10: addHistory
public function addHistory($order_id, $data)
{
$this->db->query("UPDATE `" . DB_PREFIX . "order` SET \r\n order_status_id = '" . (int) $data['order_status_id'] . "', \r\n date_modified = NOW() \r\n WHERE order_id = '" . (int) $order_id . "'");
if ($data['append']) {
$this->db->query("INSERT INTO " . DB_PREFIX . "order_history SET \r\n order_id = '" . (int) $order_id . "', \r\n order_status_id = '" . (int) $data['order_status_id'] . "', \r\n notify = '" . (isset($data['notify']) ? (int) $data['notify'] : 0) . "', \r\n comment = '" . $this->db->escape(strip_tags($data['comment'])) . "', \r\n date_added = NOW()");
}
if ($data['notify']) {
$order_query = $this->db->query("SELECT *, os.name AS status \r\n FROM `" . DB_PREFIX . "order` o \r\n LEFT JOIN " . DB_PREFIX . "order_status os ON (o.order_status_id = os.order_status_id AND os.language_id = o.language_id) \r\n LEFT JOIN " . DB_PREFIX . "language l ON (o.language_id = l.language_id) \r\n WHERE o.order_id = '" . (int) $order_id . "'");
if ($order_query->num_rows) {
$language = new Language($order_query->row['directory']);
$language->load($order_query->row['filename']);
//$language->load('mail/order');
//TODO: cargar la plantilla de email asociada con esta accion
$subject = sprintf($language->get('text_subject'), $order_query->row['store_name'], $order_id);
$message = "<p><b>" . $language->get('text_order') . ' ' . $order_id . "</b></p>";
$message .= "<p>" . $language->get('text_date_added') . ' ' . date('d-m-Y', strtotime($order_query->row['date_added'])) . "</p>";
$message .= "<p>" . $language->get('text_order_status') . ' <b>' . $order_query->row['status'] . "</b></p>";
$message .= "<p>" . $language->get('text_invoice') . "</p>";
$message .= "<a href=\"" . html_entity_decode($order_query->row['store_url'] . 'index.php?r=account/invoice&order_id=' . $order_id, ENT_QUOTES, 'UTF-8') . "\">Ver Pedido</a>";
if ($data['comment']) {
$message .= "<br /><p>" . $language->get('text_comment') . "</p>";
$message .= "<br /><p>" . strip_tags(html_entity_decode($data['comment'], ENT_QUOTES, 'UTF-8')) . "</p>";
}
$message .= $language->get('text_footer');
$this->load->library('email/mailer');
$mailer = new Mailer();
if ($this->config->get('config_smtp_method') == 'smtp') {
$mailer->IsSMTP();
$mailer->Host = $this->config->get('config_smtp_host');
$mailer->Username = $this->config->get('config_smtp_username');
$mailer->Password = base64_decode($this->config->get('config_smtp_password'));
$mailer->Port = $this->config->get('config_smtp_port');
$mailer->Timeout = $this->config->get('config_smtp_timeout');
$mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
$mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
} elseif ($this->config->get('config_smtp_method') == 'sendmail') {
$mailer->IsSendmail();
} else {
$mailer->IsMail();
}
$mailer->IsHTML();
$mailer->AddAddress($order_query->row['email'], $order_query->row['payment_firstname']);
$mailer->SetFrom($this->config->get('config_email'), $this->config->get('config_name'));
$mailer->Subject = $subject;
$mailer->Body = $message;
$mailer->Send();
}
}
}
示例11: load
public static function load()
{
// Set Path
Path::load();
// Set Link
Link::load();
// Set URL
Url::load();
// Set Language
Language::load();
// Set parameters
self::_setParameters();
// Set Controller
self::_setController();
// Set Headers
self::_setDefaultHeader();
}
示例12: index
public function index()
{
// Settings
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE store_id = '0'");
foreach ($query->rows as $setting) {
if (!$setting['serialized']) {
$this->config->set($setting['key'], $setting['value']);
} else {
$this->config->set($setting['key'], json_decode($setting['value'], true));
}
}
// Language
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "language` WHERE code = '" . $this->db->escape($this->config->get('config_admin_language')) . "'");
if ($query->num_rows) {
$this->config->set('config_language_id', $query->row['language_id']);
}
// Language
$language = new Language($this->config->get('config_admin_language'));
$language->load($this->config->get('config_admin_language'));
$this->registry->set('language', $language);
// Customer
$this->registry->set('customer', new Cart\Customer($this->registry));
// Affiliate
$this->registry->set('affiliate', new Cart\Affiliate($this->registry));
// Currency
$this->registry->set('currency', new Cart\Currency($this->registry));
// Tax
$this->registry->set('tax', new Cart\Tax($this->registry));
if ($this->config->get('config_tax_default') == 'shipping') {
$this->tax->setShippingAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
}
if ($this->config->get('config_tax_default') == 'payment') {
$this->tax->setPaymentAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
}
$this->tax->setStoreAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
// Weight
$this->registry->set('weight', new Cart\Weight($this->registry));
// Length
$this->registry->set('length', new Cart\Length($this->registry));
// Cart
$this->registry->set('cart', new Cart\Cart($this->registry));
// Encryption
$this->registry->set('encryption', new Encryption($this->config->get('config_encryption')));
// OpenBay Pro
$this->registry->set('openbay', new Openbay($this->registry));
}
示例13: index
public function index()
{
// Language Detection
$languages = array();
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "language` WHERE status = '1'");
foreach ($query->rows as $result) {
$languages[$result['code']] = $result;
}
if (isset($session->data['language']) && array_key_exists($session->data['language'], $languages)) {
$code = $session->data['language'];
} elseif (isset($request->cookie['language']) && array_key_exists($request->cookie['language'], $languages)) {
$code = $request->cookie['language'];
} else {
$detect = '';
if (isset($request->server['HTTP_ACCEPT_LANGUAGE']) && $request->server['HTTP_ACCEPT_LANGUAGE']) {
$browser_languages = explode(',', $request->server['HTTP_ACCEPT_LANGUAGE']);
foreach ($browser_languages as $browser_language) {
foreach ($languages as $key => $value) {
if ($value['status']) {
$locale = explode(',', $value['locale']);
if (in_array($browser_language, $locale)) {
$detect = $key;
break 2;
}
}
}
}
}
$code = $detect ? $detect : $config->get('config_language');
}
if (!isset($session->data['language']) || $session->data['language'] != $code) {
$session->data['language'] = $code;
}
if (!isset($request->cookie['language']) || $request->cookie['language'] != $code) {
setcookie('language', $code, time() + 60 * 60 * 24 * 30, '/', $request->server['HTTP_HOST']);
}
$config->set('config_language_id', $languages[$code]['language_id']);
$config->set('config_language', $languages[$code]['code']);
// Language
$language = new Language($languages[$code]['directory']);
$language->load($languages[$code]['directory']);
$registry->set('language', $language);
}
示例14: confirm
public function confirm($order_id)
{
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($order_id);
if ($order_info) {
$this->load->model('localisation/language');
$language = new Language($order_info['language_directory']);
$language->load('mail/voucher');
$voucher_query = $this->db->query("SELECT *, vtd.name AS theme FROM `" . DB_PREFIX . "voucher` v LEFT JOIN " . DB_PREFIX . "voucher_theme vt ON (v.voucher_theme_id = vt.voucher_theme_id) LEFT JOIN " . DB_PREFIX . "voucher_theme_description vtd ON (vt.voucher_theme_id = vtd.voucher_theme_id) AND vtd.language_id = '" . (int) $order_info['language_id'] . "' WHERE v.order_id = '" . (int) $order_id . "'");
foreach ($voucher_query->rows as $voucher) {
$data = array('recip_name' => $voucher['to_name'], 'recip_email' => $voucher['to_email'], 'store_name' => $order_info['store_name'], 'name' => $voucher['from_name'], 'amount' => $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']), 'message' => nl2br($voucher['message']), 'store_href' => $order_info['store_url'], 'image' => file_exists(DIR_IMAGE . $voucher['image']) ? $voucher['image'] : '', 'code' => $voucher['code']);
$subject = $this->emailtemplate->getSubject('Voucher', 'customer_5', $data);
$message = $this->emailtemplate->getMessage('Voucher', 'customer_5', $data);
$mail = new Mail($this->config->get('config_mail'));
$mail->setTo($voucher['to_email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender($order_info['store_name']);
$mail->setSubject($subject);
$mail->setHtml($message);
$mail->send();
}
}
}
示例15: sendVoucher
public function sendVoucher($voucher_id)
{
$voucher_info = $this->getVoucher($voucher_id);
if ($voucher_info) {
if ($voucher_info['order_id']) {
$order_id = $voucher_info['order_id'];
} else {
$order_id = 0;
}
$this->load->model('sale/order');
$order_info = $this->model_sale_order->getOrder($order_id);
// If voucher belongs to an order
if ($order_info) {
$this->load->model('localisation/language');
$language = new Language($order_info['language_directory']);
$language->load($order_info['language_filename']);
$language->load('mail/voucher');
// HTML Mail
$template = new Template();
$template->data['title'] = sprintf($language->get('text_subject'), $voucher_info['from_name']);
$template->data['text_greeting'] = sprintf($language->get('text_greeting'), $this->currency->format($voucher_info['amount'], $order_info['currency_code'], $order_info['currency_value']));
$template->data['text_from'] = sprintf($language->get('text_from'), $voucher_info['from_name']);
$template->data['text_message'] = $language->get('text_message');
$template->data['text_redeem'] = sprintf($language->get('text_redeem'), $voucher_info['code']);
$template->data['text_footer'] = $language->get('text_footer');
$this->load->model('sale/voucher_theme');
$voucher_theme_info = $this->model_sale_voucher_theme->getVoucherTheme($voucher_info['voucher_theme_id']);
if ($voucher_info && file_exists(DIR_IMAGE . $voucher_theme_info['image'])) {
$template->data['image'] = HTTP_CATALOG . 'image/' . $voucher_theme_info['image'];
} else {
$template->data['image'] = '';
}
$template->data['store_name'] = $order_info['store_name'];
$template->data['store_url'] = $order_info['store_url'];
$template->data['message'] = nl2br($voucher_info['message']);
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->hostname = $this->config->get('config_smtp_host');
$mail->username = $this->config->get('config_smtp_username');
$mail->password = $this->config->get('config_smtp_password');
$mail->port = $this->config->get('config_smtp_port');
$mail->timeout = $this->config->get('config_smtp_timeout');
$mail->setTo($voucher_info['to_email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender($order_info['store_name']);
$mail->setSubject(html_entity_decode(sprintf($language->get('text_subject'), $voucher_info['from_name']), ENT_QUOTES, 'UTF-8'));
$mail->setHtml($template->fetch('mail/voucher.tpl'));
$mail->send();
// If voucher does not belong to an order
} else {
$this->language->load('mail/voucher');
$template = new Template();
$template->data['title'] = sprintf($this->language->get('text_subject'), $voucher_info['from_name']);
$template->data['text_greeting'] = sprintf($this->language->get('text_greeting'), $this->currency->format($voucher_info['amount'], $order_info['currency_code'], $order_info['currency_value']));
$template->data['text_from'] = sprintf($this->language->get('text_from'), $voucher_info['from_name']);
$template->data['text_message'] = $this->language->get('text_message');
$template->data['text_redeem'] = sprintf($this->language->get('text_redeem'), $voucher_info['code']);
$template->data['text_footer'] = $this->language->get('text_footer');
$this->load->model('sale/voucher_theme');
$voucher_theme_info = $this->model_sale_voucher_theme->getVoucherTheme($voucher_info['voucher_theme_id']);
if ($voucher_info && file_exists(DIR_IMAGE . $voucher_theme_info['image'])) {
$template->data['image'] = HTTP_CATALOG . 'image/' . $voucher_theme_info['image'];
} else {
$template->data['image'] = '';
}
$template->data['store_name'] = $this->config->get('config_name');
$template->data['store_url'] = HTTP_CATALOG;
$template->data['message'] = nl2br($voucher_info['message']);
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->hostname = $this->config->get('config_smtp_host');
$mail->username = $this->config->get('config_smtp_username');
$mail->password = $this->config->get('config_smtp_password');
$mail->port = $this->config->get('config_smtp_port');
$mail->timeout = $this->config->get('config_smtp_timeout');
$mail->setTo($voucher_info['to_email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender($this->config->get('config_name'));
$mail->setSubject(html_entity_decode(sprintf($this->language->get('text_subject'), $voucher_info['from_name']), ENT_QUOTES, 'UTF-8'));
$mail->setHtml($template->fetch('mail/voucher.tpl'));
$mail->send();
}
}
}