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 ) ;
}
<?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 ;
}
}
A Trap with get_html_translation_table()
You may know unhtmlspecialchars() has implemented into PHP.
With former versions of PHP, we had made such a custom function using get_html_translation_table() like this:
function my_unhtmlspecialchars( $text , $quotes = ENT_QUOTES )
{
return strtr( $text , array_flip( get_html_translation_table( HTML_SPECIALCHARS , $quotes ) ) ) ;
}
<?php
var_dump( htmlspecialchars( '"\'<>&' , ENT_QUOTES ) ) ;
var_dump( get_html_translation_table( HTML_SPECIALCHARS , ENT_QUOTES ) ) ;
?>
string(25) "& quot;& #039;& lt;& gt;& amp;"
array(5) {
["""]=>
string(6) "& quot;"
["'"]=>
string(5) "& #39;"
["<"]=>
string(4) "& lt;"
[">"]=>
string(4) "& gt;"
["& "]=>
string(5) "& amp;"
}
Somehow, I cannot find EmailLogin for XCL2.1, though it must have been already created by someone.
Then, I've just created a preload.
Download and try it.
http://www.peak.ne.jp/support/xoops/XCL_EmailLoginHack.tar.gz
Of course, you can use this preload with cubeUtils module (auto-login).
There are a lot of invalid feeds of RSS/Atom in the world.
eg) http://feedanalyzer.com/?url=http%3A%2F%2Fwww.ec-cube.net%2Fec-cube.php
But we cannot fix the feed by ourselves. (just claim it)
Then, you can use 'tidy' for such a purpose.
With d3pipes 0.61, we added a joint D3pipesReplaceTidy4xml.
Just insert 'tidy4xml' before xml parser.
You will receive such invalid RSS/Atom into your XOOPS.
resource.(type).php is a smarty plugin controlling:
- which template source is adopted
- how new is the template
Since default template resource of XOOPS is "db:", resource.db.php is the most important file.
Default resource.db.php of XCL2.1 has problems like:
(1) With "default" theme, DB templates will be broken easily
(2) Templates under theme will stay alive even after the theme is changed
(3) Paths of templates under theme should be flat because "db:" is flat.
(4) Directory name of "template under theme" is not unified. (templates or modules)
(5) A template file under theme is not recognized its deletion
(6) A template file under theme is not recognized its addition if the compile cache is newer than the file
I've made a new resource.db.php solving the problems (1),(2),(3), and (4).
Of course, it is not a hack.
Just using "XoopsTpl Hooking" by preload, we can put the file under XOOPS_TRUST_PATH/libs/smartyplugins/
You can test it right now.
Just try hodajuku distribution of nightly build (not a preview version).
The theme of "skel_flex" has many templates.
The tempaltes will be adopted with the theme, hence they will never adopted after switching the theme like "chic_black".