Class Ethna_Util

Description

ユーティリティクラス

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


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

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

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

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

  • access: public
void chmod ( $file,  $mode)
  • $file
  • $mode
static clearDuplicatePost (line 162)

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

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

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

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

CSVエスケープ処理を行う

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

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

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

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

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

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

  • return: 文字列にフォーマットされたバックトレース
  • access: public
string formatBacktrace (array $bt)
  • array $bt: debug_backtrace()関数で取得したバックトレース
static 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軸)
static getDirectLinkList (line 437)

Google風リンクリストを返す

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

元号制での年を返す

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

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

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

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

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

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

Site url from request uri (instead of a config)

  • access: public
void getUrlFromRequestUri ()
static isAbsolute (line 665)

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

port from File in PEAR (for BC)

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

CSRFをチェックする

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

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

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

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

  • access: public
void isRootDir (string $path)
  • string $path
static 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なら無限)
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
static purgeTmp (line 795)

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

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

CSRFをチェックする

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

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

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

Documentation generated on Fri, 11 Nov 2011 03:59:19 +0900 by phpDocumentor 1.4.3