Mercurial > epgrec.yaz
view reclib.php @ 175:f68f63465a41 default tip
handles RecException instead of Exception
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Tue, 16 Apr 2013 15:24:02 +0900 |
parents | 0ded1d3bd448 |
children |
line wrap: on
line source
<?php // ライブラリ function toTimestamp( $string ) { sscanf( $string, "%4d-%2d-%2d %2d:%2d:%2d", $y, $mon, $day, $h, $min, $s ); return mktime( $h, $min, $s, $mon, $day, $y ); } function toDatetime( $timestamp ) { return date("Y-m-d H:i:s", $timestamp); } function jdialog( $message, $url = "index.php" ) { header( "Content-Type: text/html;charset=utf-8" ); exit( "<script type=\"text/javascript\">\n" . "<!--\n". "alert(\"". $message . "\");\n". "window.open(\"".$url."\",\"_self\");". "// -->\n</script>" ); } // マルチバイトstr_replace function mb_str_replace($search, $replace, $target, $encoding = "UTF-8" ) { $notArray = !is_array($target) ? TRUE : FALSE; $target = $notArray ? array($target) : $target; $search_len = mb_strlen($search, $encoding); $replace_len = mb_strlen($replace, $encoding); foreach ($target as $i => $tar) { $offset = mb_strpos($tar, $search); while ($offset !== FALSE){ $tar = mb_substr($tar, 0, $offset).$replace.mb_substr($tar, $offset + $search_len); $offset = mb_strpos($tar, $search, $offset + $replace_len); } $target[$i] = $tar; } return $notArray ? $target[0] : $target; } ?>