本文整理汇总了PHP中mb_language函数的典型用法代码示例。如果您正苦于以下问题:PHP mb_language函数的具体用法?PHP mb_language怎么用?PHP mb_language使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mb_language函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mailDefault
function mailDefault($template, $to, $data)
{
$arrayMail = array();
$file = file($template);
//Get values from template mail
foreach ($file as $value) {
if ($value != "") {
list($key, $val) = explode("=>", $value);
$key = trim($key);
$val = trim($val);
$arrayMail[$key] = $val;
}
}
$subject = $arrayMail['subject'];
$from = $arrayMail['from'];
$body = $arrayMail['body'];
$body = str_replace('\\r\\n', "\n", $body);
// $headers .= "MIME-Version: 1.0\r\n";
// $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
// $headers .= "From: $from\r\n";
//push value from in parameter to body mail
foreach ($data as $key => $item) {
$body = str_replace('{$' . $key . '}', $item, $body);
}
//Execute send mail
mb_language("Japanese");
mb_internal_encoding("UTF-8");
if (mb_send_mail($to, $subject, $body, "From: " . $from)) {
return true;
} else {
return false;
}
}
示例2: sendMail
/**
* メール送信処理
*/
private function sendMail()
{
//メールを送信する処理
// $mailer = jpSimpleMail::create('SwiftMailer4'); // このサンプルではSwift Mailerを利用しています。
// $mailer->setSubject('メール送信テストです');
// $mailer->setSender('kobari1984@gmail.com');
// $mailer->addTo(sprintf('%s <%s>', '宛先 太郎', 'kobari1984@gmail.com'));
// $mailer->setFrom(sprintf('%s <%s>', '管理者', 'kobari1984@gmail.com'));
// $mailer->setBody('本文です');
//// var_dump($mailer->getFrom());
// try{
// $rs = $mailer->send();
// }catch(jpSendMailException $e){
// echo 'exception';
// }
//
// var_dump($rs);
mb_language('ja');
mb_internal_encoding('UTF-8');
$to = sfConfig::get('sf_iquiry_mail');
//宛先
$subject = "お問い合わせ";
//題名
$body = $this->getRequestParameter('message');
//本文
$from = sfConfig::get('sf_iquiry_mail');
//差出人
//これでは文字化け!
mail($to, $subject, $body, "From:" . $from);
}
示例3: mail_to
public static function mail_to($value, $mails)
{
//return md5($value);
mb_language("japanese");
mb_internal_encoding("utf-8");
$email = mb_encode_mimeheader("チラシシステム") . "<zuo@it-art.jp>";
$subject = $value["title"];
$body = $value["text"];
//$from = "lightbox@sdc";
//ini_set( "SMTP", "localhost" );
//ini_set( "smtp_port", 25 );
//ini_set( "sendmail_from", $from );
$bccs = implode(' ,', $mails);
$header = "From: " . mb_encode_mimeheader("チラシシステム") . "<zuo@it-art.jp>";
$header .= "\n";
$header = "Bcc:" . $bccs;
//$header ="Bcc:zuo@it-art.jp,zou@shift-jp.net";
$header .= "\n";
if (!@mb_send_mail(NULL, $subject, $body, $header)) {
// echo "*********mb_send_mailエラー**************";
return false;
} else {
//echo "*********sucess**************";
return true;
}
}
示例4: initialize
public function initialize()
{
$this->setMailer(new PHPMailer());
mb_language('Ja');
$this->setCharset('iso-2022-jp');
$this->setEncoding('7bit');
}
示例5: initMbstring
static function initMbstring()
{
if (extension_loaded('mbstring')) {
if (((int) ini_get('mbstring.encoding_translation') || in_array(strtolower(ini_get('mbstring.encoding_translation')), array('on', 'yes', 'true'))) && !in_array(strtolower(ini_get('mbstring.http_input')), array('pass', '8bit', 'utf-8'))) {
user_error('php.ini settings: Please disable mbstring.encoding_translation or set mbstring.http_input to "pass"', E_USER_WARNING);
}
if (MB_OVERLOAD_STRING & (int) ini_get('mbstring.func_overload')) {
user_error('php.ini settings: Please disable mbstring.func_overload', E_USER_WARNING);
}
mb_regex_encoding('UTF-8');
ini_set('mbstring.script_encoding', 'pass');
if ('utf-8' !== strtolower(mb_internal_encoding())) {
mb_internal_encoding('UTF-8');
ini_set('mbstring.internal_encoding', 'UTF-8');
}
if ('none' !== strtolower(mb_substitute_character())) {
mb_substitute_character('none');
ini_set('mbstring.substitute_character', 'none');
}
if (!in_array(strtolower(mb_http_output()), array('pass', '8bit'))) {
mb_http_output('pass');
ini_set('mbstring.http_output', 'pass');
}
if (!in_array(strtolower(mb_language()), array('uni', 'neutral'))) {
mb_language('uni');
ini_set('mbstring.language', 'uni');
}
} else {
if (!defined('MB_OVERLOAD_MAIL')) {
extension_loaded('iconv') or static::initIconv();
require __DIR__ . '/Bootup/mbstring.php';
}
}
}
示例6: noticePackageUploaded
public function noticePackageUploaded(Package $pkg)
{
$app = $this->app;
$package_url = mfwRequest::makeURL("/package?id={$pkg->getId()}");
ob_start();
include APP_ROOT . '/data/notice_mail_template.php';
$body = ob_get_clean();
$addresses = array();
foreach ($this->rows as $r) {
if ($r['notify']) {
$addresses[] = $r['mail'];
}
}
if (empty($addresses)) {
return;
}
$subject = "New Package Uploaded to {$app->getTitle()}";
$sender = Config::get('mail_sender');
$to = $sender;
$header = "From: {$sender}" . "\nBcc: " . implode(', ', $addresses);
mb_language('uni');
mb_internal_encoding('UTF-8');
if (!mb_send_mail($to, $subject, $body, $header)) {
throw new RuntimeException("mb_send_mail faild (pkg={$pkg->getId()}, {$pkg->getTitle()})");
}
}
示例7: exec
/**
*
* @param string $html
*/
public function exec($html)
{
mb_language('Japanese');
// 1.プリプロセス
// scriptテキスト削除
// script内に文字列リテラルの閉じタグがあるとDomDocumentがscriptのソースを#text扱いしてしまうので
// script内の文字を削除する
// 正規表現で削除しようとするとSegmentation faultが発生する(StackOverFlow?)ので
// simple_html_domでscript内文字列を削除
// MAX_FILE_SIZEの制限にひっかかったので、ソースを編集してデフォルトの3倍に変更している
$simpleHtml = str_get_html($html);
foreach ($simpleHtml->find('script') as $script) {
$script->innertext = '';
}
$html = $simpleHtml->outertext;
// トリム
// $html = preg_replace('/(\s| )+/mi', ' ', $html);
// 2. dom生成
$doc = new DomDocument("1.0", "utf-8");
@$doc->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));
$node = $doc->getElementsByTagName('body')->item(0);
$this->preProcessedInput = $node->textContent;
// 3.プロパティを初期化
$this->domXPath = new DomXPath($doc);
$this->title = @$doc->getElementsByTagName('title')->item(0)->textContent;
$text = $this->scan($node);
$this->textAll = $text;
$this->domCountAll = $this->domCount;
$this->pancutuationCountAll = $this->calcKutenScore($text) + $this->calcTotenScore($text);
$this->textLengthAll = mb_strlen($text);
$this->highScore = -1000000;
$this->extracedNode = null;
// 4.実行
$this->extract($node);
}
示例8: __construct
/**
* Constructor.
*
* @access protected
*/
protected function __construct()
{
// Init Config
Config::init();
// Turn on output buffering
ob_start();
// Display Errors
Config::get('system.errors.display') and error_reporting(-1);
// Set internal encoding
function_exists('mb_language') and mb_language('uni');
function_exists('mb_regex_encoding') and mb_regex_encoding(Config::get('system.charset'));
function_exists('mb_internal_encoding') and mb_internal_encoding(Config::get('system.charset'));
// Set default timezone
date_default_timezone_set(Config::get('system.timezone'));
// Start the session
Session::start();
// Init Cache
Cache::init();
// Init Plugins
Plugins::init();
// Init Blocks
Blocks::init();
// Init Pages
Pages::init();
// Flush (send) the output buffer and turn off output buffering
ob_end_flush();
}
示例9: _setupMbstring
function _setupMbstring()
{
#ifdef _MBSTRING_LANGUAGE
if (defined('_MBSTRING_LANGUAGE') && function_exists("mb_language")) {
if (@mb_language(_MBSTRING_LANGUAGE) != false && @mb_internal_encoding(_CHARSET) != false) {
define('MBSTRING', true);
} else {
mb_language("neutral");
mb_internal_encoding("ISO-8859-1");
if (!defined('MBSTRING')) {
define('MBSTRING', false);
}
}
if (function_exists('mb_regex_encoding')) {
@mb_regex_encoding(_CHARSET);
}
ini_set('mbstring.http_input', 'pass');
ini_set('mbstring.http_output', 'pass');
ini_set('mbstring.substitute_character', 'none');
}
#endif
if (!defined("MBSTRING")) {
define("MBSTRING", FALSE);
}
}
示例10: execute
/**
* Mobile用クラス実行
*
* @access public
*
*/
function execute()
{
$this->_container =& DIContainerFactory::getContainer();
$this->_log =& LogFactory::getLog();
$this->_filterChain =& $this->_container->getComponent("FilterChain");
$this->_actionChain =& $this->_container->getComponent("ActionChain");
$this->_db =& $this->_container->getComponent("DbObject");
$this->_session =& $this->_container->getComponent("Session");
$this->_request =& $this->_container->getComponent("Request");
$this->_modulesView =& $this->_container->getComponent("modulesView");
//$this->_mobile_obj = $this->_modulesView->getModuleByDirname("mobile");
$this->_usersView =& $this->_container->getComponent("usersView");
//mb_stringがロードされているかどうか
if (!extension_loaded('mbstring') && !function_exists("mb_convert_encoding")) {
include_once MAPLE_DIR . '/includes/mbstring.php';
} else {
if (function_exists("mb_detect_order")) {
mb_detect_order(_MB_DETECT_ORDER_VALUE);
}
}
if (function_exists("mb_internal_encoding")) {
mb_internal_encoding(INTERNAL_CODE);
}
if (function_exists("mb_language")) {
mb_language("Japanese");
}
$this->_log->trace("{$this->_classname}の前処理が実行されました", "{$this->_classname}#execute");
$this->_preFilter();
$this->_filterChain->execute();
$this->_log->trace("{$this->_classname}の後処理が実行されました", "{$this->_classname}#execute");
$this->_postFilter();
}
示例11: run
/**
* Run an application
*/
public static function run()
{
// Error reporting
error_reporting(ENV === 'production' ? E_ERROR | E_WARNING | E_PARSE : -1);
ini_set('display_errors', ENV === 'production' ? 0 : 1);
// Services
$services = Services::getInstance();
// Global configuration
$config = $services->config()->get('config');
// UTF-8 support
if (isset($config['utf8']) && $config['utf8']) {
mb_internal_encoding('UTF-8');
mb_http_output('UTF-8');
mb_http_input('UTF-8');
mb_language('uni');
mb_regex_encoding('UTF-8');
ob_start('mb_output_handler');
} else {
ob_start();
}
// Set Locales
if (isset($config['locale']) && $config['locale']) {
setlocale(LC_ALL, $config['locale']);
setlocale(LC_NUMERIC, 'C');
}
// Call controller
if ($route = $services->route()) {
list($class, $method, $params) = $route;
$controller = new $class();
$controller->{$method}(...$params);
}
$services->output()->display(!$services->input()->isClient());
ob_end_flush();
}
示例12: resultAction
public function resultAction()
{
$post = $this->request->getPost();
$email = $post["email"];
$error = array();
if ("" == $email) {
array_push($error, "メールアドレスを入力してください");
} else {
$pre_user_id = uniqid(rand(100, 999));
$userModel = new Users();
$result = $userModel->addEmail(array($pre_user_id, $email));
if (false == $result) {
array_push($error, "データベースに登録できませんでした。");
} else {
mb_language("japanese");
mb_internal_encoding("utf-8");
$to = $email;
$subject = "seapaメンバー登録URL";
$message = "以下のURLよりメンバー登録を行ってください。\n" . "http://localhost/regist/input/{$pre_user_id}";
$header = "From: mail.seapa@gmail.com";
if (!mb_send_mail($to, $subject, $message, $header, '-f' . 'mail.seapa@gmail.com')) {
array_push($error, "メールが送信できませんでした。<a href='http://localhost/regist/input/{$pre_user_id}'>遷移先</a>");
}
$this->view->assign('email', $email);
}
}
}
示例13: send_attached_mail
public static function send_attached_mail($to, $subject, $plain_message, $from, $attachment = null, $fileName = null, $attach_mime_type = null)
{
if ($attachment === null) {
self::send_mail($to, $subject, $plain_message, $from);
} else {
$fileName = mb_encode_mimeheader(mb_convert_encoding(basename($fileName), "ISO-2022-JP", 'auto'));
$from = mb_encode_mimeheader(mb_convert_encoding(basename($from), "ISO-2022-JP", 'auto'));
//必要に応じて適宜文字コードを設定してください。
mb_language('Ja');
mb_internal_encoding('UTF-8');
$boundary = '__BOUNDARY__' . md5(rand());
$headers = "Content-Type: multipart/mixed;boundary=\"{$boundary}\"\n";
$headers .= "From: {$from}<{$from}>\n";
$headers .= "Reply-To: {$from}\n";
$body = "--{$boundary}\n";
$body .= "Content-Type: text/plain; charset=\"ISO-2022-JP\"\n";
$body .= "\n{$plain_message}\n";
$body .= "--{$boundary}\n";
$body .= "Content-Type: {$attach_mime_type}; name=\"{$fileName}\"\n";
$body .= "Content-Disposition: attachment; filename=\"{$fileName}\"\n";
$body .= "Content-Transfer-Encoding: base64\n";
$body .= "\n";
$body .= chunk_split(base64_encode($attachment)) . "\n";
$body .= "--{$boundary}--";
$ret = mb_send_mail($to, $subject, $body, $headers);
return $ret;
}
}
示例14: startup
public function startup(Controller $Controller)
{
$this->Controller = $Controller;
if (extension_loaded('mbstring')) {
switch (Configure::read('Config.language')) {
case 'jpn':
$lang = "ja";
break;
case 'eng':
$lang = "en";
break;
default:
$lang = "uni";
}
mb_language($lang);
mb_internal_encoding("UTF-8");
}
//tmp crash fix
$email = "candycane@example.com";
if (Validation::email($this->Controller->Setting->mail_from)) {
$email = $this->Controller->Setting->mail_from;
}
$this->Email = new CakeEmail(array('transport' => $this->Controller->Setting->mail_transport, 'from' => $email, 'host' => $this->Controller->Setting->mail_host, 'port' => $this->Controller->Setting->mail_port, 'username' => $this->Controller->Setting->mail_username, 'password' => $this->Controller->Setting->mail_password));
$this->Email->viewVars(array('footer' => $this->Controller->Setting->emails_footer));
if ($this->Controller->Setting->plain_text_mail) {
$this->Email->emailFormat('text');
} else {
$this->Email->emailFormat('both');
}
}
示例15: BusRegister
/**
* constractor
*/
function BusRegister()
{
$this->util = new BusUtil();
$this->db = new BusDb();
$this->db->connect();
mb_language("Japanese");
mb_internal_encoding("UTF-8");
}