Class Ethna_Util

Description

ユーティリティクラス

Located in /class/Ethna_Util.php (line 111)


	
			
Method Summary
 static void isRootDir (string $path)
 static bool mkdir (string $dir, int $mode)
 static bool purgeDir ( $dir, string $file)
 bool checkMailAddress (string $mailaddress)
 void chmod ( $file,  $mode)
 エンコード済みの文字列 encode_MIME (string $string)
 string escapeCSV (string $csv, [bool $escape_nl = false])
 array escapeHtml (array $target)
 mixed explodeCSV (string $csv, [string $delimiter = ","])
 string formatBacktrace (array $bt)
 array get2dArray (array $array, int $m, int $order)
 array getDirectLinkList (int $total, int $offset, int $count)
 string getEra (int $t)
 string getImageExtName (int $type)
 string getRandom ([int $length = 64])
 bool isAbsolute (string $path)
 bool isCsrfSafe ()
 bool isDuplicatePost ()
 int lockFile (string $file, int $mode, [int $timeout = 0])
 void purgeTmp (string $prefix, int $timeout)
 bool setCsrfID ()
 void unlockFile (int $lh)
 void _escapeHtml ( &$vars,  &$retval, mixed $vars, mixed $retval)
Methods
static isRootDir (line 690)

パス名がルートディレクトリかどうかを返す

  • access: public
void isRootDir (string $path)
  • string $path
static mkdir (line 713)

mkdir -p

  • return: true:成功 false:失敗
  • access: public
bool mkdir (string $dir, int $mode)
  • string $dir: 作成するディレクトリ
  • int $mode: パーミッション
static purgeDir (line 758)

ディレクトリを再帰的に削除する (途中で失敗しても中断せず、削除できるものはすべて消す)

  • return: true:成功 false:失敗
  • access: public
bool purgeDir ( $dir, string $file)
  • string $file: 削除するファイルまたはディレクトリ
  • $dir
checkMailAddress (line 239)

メールアドレスが正しいかどうかをチェックする

  • return: true: 正しいメールアドレス false: 不正な形式
  • access: public
bool checkMailAddress (string $mailaddress)
  • string $mailaddress: チェックするメールアドレス
chmod (line 738)

ファイルのパーミッションを変更する

void chmod ( $file,  $mode)
  • $file
  • $mode
clearDuplicatePost (line 162)

POSTのユニークチェックフラグをクリアする

  • return: 0:正常終了 Ethna_Error:エラー
mixed clearDuplicatePost ()
encode_MIME (line 412)

文字列をMIMEエンコードする

  • access: public
エンコード済みの文字列 encode_MIME (string $string)
  • string $string: MIMEエンコードする文字列
escapeCSV (line 354)

CSVエスケープ処理を行う

  • return: CSVエスケープされた文字列
  • access: public
string escapeCSV (string $csv, [bool $escape_nl = false])
  • string $csv: エスケープ対象の文字列(CSVの各要素)
  • bool $escape_nl: 改行文字(\r/\n)のエスケープフラグ
escapeHtml (line 377)

配列の要素を全てHTMLエスケープして返す

  • return: エスケープされた配列
  • access: public
array escapeHtml (array $target)
  • array $target: HTMLエスケープ対象となる配列
explodeCSV (line 258)

CSV形式の文字列を配列に分割する

  • return: (array):分割結果 Ethna_Error:エラー(行継続)
  • access: public
mixed explodeCSV (string $csv, [string $delimiter = ","])
  • string $csv: CSV形式の文字列(1行分)
  • string $delimiter: フィールドの区切り文字
formatBacktrace (line 878)

バックトレースをフォーマットして返す

  • return: 文字列にフォーマットされたバックトレース
  • access: public
string formatBacktrace (array $bt)
  • array $bt: debug_backtrace()関数で取得したバックトレース
get2dArray (line 625)

1次元配列をm x nに再構成する

  • return: m x nに再構成された配列
  • access: public
array get2dArray (array $array, int $m, int $order)
  • array $array: 処理対象の1次元配列
  • int $m: 軸の要素数
  • int $order: $mをX軸と見做すかY軸と見做すか(0:X軸 1:Y軸)
getDirectLinkList (line 437)

Google風リンクリストを返す

  • return: リンク情報を格納した配列
  • access: public
array getDirectLinkList (int $total, int $offset, int $count)
  • int $total: 検索総件数
  • int $offset: 表示オフセット
  • int $count: 表示件数
getEra (line 499)

元号制での年を返す

  • return: 元号(不明な場合はnull)
  • access: public
string getEra (int $t)
  • int $t: unix time
getImageExtName (line 524)

getimagesize()の返すイメージタイプに対応する拡張子を返す

  • access: public
string getImageExtName (int $type)
  • int $type: getimagesize()関数の返すイメージタイプ
getRandom (line 559)

ランダムなハッシュ値を生成する

決して高速ではないので乱用は避けること

  • return: ハッシュ値
  • access: public
string getRandom ([int $length = 64])
  • int $length: ハッシュ値の長さ(〜64)
isAbsolute (line 665)

パス名が絶対パスかどうかを返す

port from File in PEAR (for BC)

  • return: true:絶対パス false:相対パス
  • access: public
bool isAbsolute (string $path)
  • string $path
isCsrfSafe (line 194)

CSRFをチェックする

  • return: true:正常なPOST false:不正なPOST
  • access: public
bool isCsrfSafe ()
isDuplicatePost (line 120)

POSTのユニークチェックを行う

  • return: true:2回目以降のPOST false:1回目のPOST
  • access: public
bool isDuplicatePost ()
lockFile (line 829)

ファイルをロックする

  • return: ロックハンドル(falseならエラー)
  • access: public
int lockFile (string $file, int $mode, [int $timeout = 0])
  • string $file: ロックするファイル名
  • int $mode: ロックモード('r', 'rw')
  • int $timeout: ロック待ちタイムアウト(秒−0なら無限)
purgeTmp (line 795)

テンポラリディレクトリのファイルを削除する

  • access: public
void purgeTmp (string $prefix, int $timeout)
  • string $prefix: ファイルのプレフィクス
  • int $timeout: 削除対象閾値(秒−60*60*1なら1時間)
setCsrfID (line 216)

CSRFをチェックする

  • return: true:成功
  • access: public
bool setCsrfID ()
unlockFile (line 864)

ファイルのロックを解除する

  • access: public
void unlockFile (int $lh)
  • int $lh: ロックハンドル
_escapeHtml (line 391)

配列の要素を全てHTMLエスケープして返す

  • access: public
void _escapeHtml ( &$vars,  &$retval, mixed $vars, mixed $retval)
  • mixed $vars: HTMLエスケープ対象となる配列
  • mixed $retval: HTMLエスケープ対象となる子要素
  • &$vars
  • &$retval

Documentation generated on Fri, 11 Nov 2011 04:01:06 +0900 by phpDocumentor 1.4.3