PEAK XOOPS - News in englishin japanese

Archive | RSS |
  
Poster : GIJOE on 2008-06-13 16:24:49 (8722 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


Poster : GIJOE on 2008-05-16 04:55:48 (11690 reads)

A Trap with get_html_translation_table()in englishin japanese
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 ) ) ) ;
}


Recently, I find the function never convert & #039; into single quotes.
This is a result of my investigation.
Code:

<?php
        var_dump( htmlspecialchars( '"\'<>&' , ENT_QUOTES ) ) ;
        var_dump( get_html_translation_table( HTML_SPECIALCHARS , ENT_QUOTES ) ) ;
?>

Result:

string(25) "& quot;& #039;& lt;& gt;& amp;"
array(5) {
  ["""]=>
  string(6) "& quot;"
  ["'"]=>
  string(5) "& #39;"
  ["<"]=>
  string(4) "& lt;"
  [">"]=>
  string(4) "& gt;"
  ["& "]=>
  string(5) "& amp;"
}

& #039 and & #39; ...

This bug(?) are alive in PHP versions from PHP 4.3.10 to 5.2.5 at least.
We have to consider this trap for some time.


Poster : GIJOE on 2008-04-30 05:36:07 (12658 reads)

in englishin japanese
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).

0 comments

Poster : GIJOE on 2008-04-29 05:25:45 (9389 reads)

in englishin japanese
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.

0 comments

Poster : GIJOE on 2008-01-10 04:53:50 (16325 reads)

in englishin japanese
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".

Read more... | 2881 bytes more |9 comments

« 1 ... 3 4 5 (6) 7 8 9 ... 55 »
Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!