A preload makes cubeUtils compatible with EMLH

Date 2008-06-13 16:24:49 | Category: XOOPS

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





You can read more news at PEAK XOOPS.
http://xoops.peak.ne.jp

The URL for this story is:
http://xoops.peak.ne.jp/md/news/index.php?page=article&storyid=455