PEAK XOOPS - A preload makes cubeUtils compatible with EMLH in englishin japanese

Archive | RSS |
XOOPS
XOOPS : A preload makes cubeUtils compatible with EMLH
Poster : GIJOE on 2008-06-13 16:24:49 (8721 reads)

in englishin japanese
For multilanguation, I often use such a flagment of php code in my modules like this:


if( function_exists('easiestml') ) {
	$mail_body = easiestml( $mail_body ) ;
}

This code removes language tags and needless text from text for e-mail etc.

If you use XCL2.1 with cubeUtils module instead of EMLH, just try this preload with MultiLanguagePreLoad.class.php of cubeUtils.

MultiLanguageCompatibleEMLH.class.php

<?php
function easiestml( $s , $lang = '' )
{
	global $cubeUtilMlang ;

	if( is_object( @$cubeUtilMlang ) ) {
		if( $lang ) {
			$orig_lang = $cubeUtilMlang->mLanguage ;
			$cubeUtilMlang->mLanguage = $lang ;
			$ret = $cubeUtilMlang->obFilter( $s ) ;
			$cubeUtilMlang->mLanguage = $orig_lang ;
			return $ret ;
		} else {
			return $cubeUtilMlang->obFilter( $s ) ;
		}
	} else {
		return $s ;
	}
}

This preload allows you to process multilingual email eg) pico's form mail
----
(2008/06/22 updated)
2nd parameter is added for the compatibility with EMLH 1.30


Printer friendly page Send this story to a friend

Comments list

GIJOE  Posted on 2008/6/22 17:18 | Last modified
nobunobuさん、こんにちは。
コメントありがとうございます。

Quote:

nobunobu wrotes:
同じような関数定義を、小生のとあるサイトでは、
直接、MultiLanguagePreLoad.class.php内に追加定義してたりしてました

EMLH-1.30互換となるpreloadを作っていたら確かに、

function cubeUtil_MLConvert($str)

というグローバルスコープの関数を見つけてしまいました
(グローバルスコープなフィルタ関数だと、Smartyで直接使えるのがメリット大きい)

それでも、preloadは1ファイル1機能の方が判りやすいですし、EMLH-1.30互換なんて後付けもできて便利ですね
avtx30  Posted on 2008/6/13 22:39
ありがとうございます。早速導入しました。
nobunobu  Posted on 2008/6/13 17:37
これ・・・
同じような関数定義を、小生のとあるサイトでは、
直接、MultiLanguagePreLoad.class.php内に追加定義してたりしてました・・・別のプリロードの方がスマートですね^^
Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!