當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Languages::Get方法代碼示例

本文整理匯總了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;
}
開發者ID:mozdial,項目名稱:Directory,代碼行數:65,代碼來源:functions.common.inc.php


注:本文中的Languages::Get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。