Created
November 24, 2009 13:10
-
-
Save koshiaaaaan/241862 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// OSがサポートしているディレクトリの区切り文字 | |
// Windowsでは\、Linuxでは/ | |
$dir_sep = DIRECTORY_SEPARATOR ; | |
// このファイル自身(絶対パス) | |
$file = __FILE__ ; | |
// このファイルの置かれているディレクトリ(絶対パス) | |
$dir = dirname( __FILE__ ) ; | |
// 実行中のファイルが置かれているディレクトリ(絶対パス) | |
$realpath = realpath( '.' ) ; | |
// マジッククォート機能ON/OFFの差異をなくす(自作関数) | |
function normalize_magic_quotes_gpc( $arg ) { | |
if( is_array( $arg ) ) { | |
return array_map( 'normalize_magic_quotes_gpc', $arg ) ; | |
} | |
return ( get_magic_quotes_gpc() ) ? stripslashes( $arg ) : $arg ; | |
} | |
// htmlspecialcharsの配列対応ラッパー関数(自作関数) | |
// 基本的に出力時にのみ使うこと。 | |
function h( $arg, $quote_style = ENT_QUOTES, $charset = '', $double_encode = true ) { | |
if( is_array( $arg ) ) { | |
foreach( $arg as $key => $var ) { | |
$arg[ $key ] = h( $var, $quote_style, $charset, $double_encode ) ; | |
} | |
return $arg ; | |
} | |
return htmlspecialchars( $arg, $escape, $charset, $double_encode ) ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment