本文整理匯總了PHP中Languages::Get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Languages::Get方法的具體用法?PHP Languages::Get怎麽用?PHP Languages::Get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Languages
的用法示例。
在下文中一共展示了Languages::Get方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: send_email_wo_template
/**
* Send email
* @param $recipient
* @param $sender
* @param $title
* @param $body
* @param $lang
* @param $debug
*/
function send_email_wo_template($recipient, $sender, $subject, $body, $lang = '', $debug = false)
{
global $objSettings;
if ($lang == '') {
$lang = Application::Get('lang');
$lang_dir = Application::Get('lang_dir');
} else {
$lang_dir = Languages::Get($lang, 'lang_dir');
}
$text = '<div style="direction:' . $lang_dir . '">';
$text .= $body;
$text .= '</div>';
if ($objSettings->GetParameter('mailer') == 'smtp') {
$mail = PHPMailer::Instance();
$mail->IsSMTP();
// telling the class to use SMTP
$mail->SMTPDebug = 0;
// enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true;
// enable SMTP authentication
$mail->SMTPSecure = 'ssl';
// sets the prefix to the server
$mail->Host = $objSettings->GetParameter('smtp_host');
$mail->Port = $objSettings->GetParameter('smtp_port');
$mail->Username = $objSettings->GetParameter('smtp_username');
$mail->Password = $objSettings->GetParameter('smtp_password');
$mail->ClearAddresses();
// clear previously added 'To' addresses
$mail->ClearReplyTos();
// clear previously added 'ReplyTo' addresses
$mail->SetFrom($sender);
// $mail->SetFrom($mail_from, 'First Last');
$mail->AddReplyTo($sender);
// $mail->AddReplyTo($mail_to, 'First Last');
$mail->AddAddress($recipient);
// $mail->AddAddress($mail_to, 'John Doe');
$mail->Subject = $subject;
$mail->AltBody = strip_tags($body);
$mail->MsgHTML(nl2br($text));
$result = $mail->Send();
} else {
$text_version = strip_tags($text);
$html_version = nl2br($text);
$objEmail = new Email($recipient, $sender, $subject);
$objEmail->textOnly = false;
$objEmail->content = $html_version;
$result = $objEmail->Send();
}
if ($debug) {
echo $text;
exit;
}
return $result;
}