Utils
class Utils
各種ユーティリティクラス.
主に static 参照するユーティリティ系の関数群
:XXX: 内部でインスタンスを生成している関数は, Helper クラスへ移動するべき...
Methods
No description
インストーラーの URL を返す
相対パスで記述された URL から絶対パスの URL を取得する.
No description
No description
No description
文字列をアスタリスクへ変換する.
HTTPSかどうかを判定
正規の遷移がされているかを判定 前画面でuniqidを埋め込んでおく必要がある
No description
No description
INT型の数値チェック ・FIXME: マイナス値の扱いが不明確 ・XXX: INT_LENには収まるが、INT型の範囲を超えるケースに対応できないのでは?
桁が0で埋められているかを判定する
No description
No description
No description
キーと値をセットした配列を取得(値が複数の場合) 使用されていない
No description
No description
checksetterm 年月日に別れた2つの期間の妥当性をチェックし、整合性と期間を返す 引数 (開始年,開始月,開始日,終了年,終了月,終了日) 戻値 array(1,2,3) 1.開始年月日 (YYYY/MM/DD 000000) 2.終了年月日 (YYYY/MM/DD 235959) 3.エラー (0 = OK, 1 = NG)
No description
No description
No description
No description
No description
No description
税金額を返す
税金付与した金額を返す
桁数を指定して四捨五入
ポイント付与 $product_id が使われていない。
No description
商品IDとカテゴリIDから商品規格IDを取得する
No description
No description
配列をキー名ごとの配列に変更する
連想配列から新たな配列を生成して返す.
No description
加算ポイントの計算
No description
二回以上繰り返されているスラッシュ[/]を一つに変換する。
テキストファイルの文字エンコーディングを変換する.
No description
No description
No description
No description
PHPのmbconvertencoding関数をSmartyでも使えるようにする
No description
No description
No description
No description
ブラウザに強制的に送出する
No description
$array の要素を $arrConvList で指定した方式で mbconvertkana を適用する.
配列の添字が未定義の場合は空文字を代入して定義する.
$arrSrc のうち、キーが $arrKey に含まれるものを返す
配列をテーブルタグで出力する。
指定の画像のパスを返す
一覧-メイン画像のファイル指定がない場合、専用の画像ファイルに書き換える。
詳細-メイン画像のファイル指定がない場合、専用の画像ファイルに書き換える。
デバッグ用
ランダムな文字列を取得する
No description
変数が空白かどうかをチェックする.
指定されたURLのドメインが一致するかを返す
パスワードのハッシュ化
パスワード文字列のハッシュ一致判定
検索結果の1ページあたりの最大表示件数を取得する
値を JSON 形式にして返す.
JSON 文字列をデコードする.
パスが絶対パスかどうかをチェックする.
ディレクトリを再帰的に作成する.
No description
PHP のタイムアウトを延長する
コンパイルファイルを削除します.
指定されたパスの配下を再帰的にコピーします.
文字列を区切り文字を挟み反復する
RFC3986に準拠したURIエンコード MEMO: PHP5.3.0未満では、~のエンコードをしてしまうための処理
マルチバイト対応の trim
マルチバイト対応の ltrim
マルチバイト対応の rtrim
文字列のトリム処理で使用する PCRE のパターン
データ量の単位を付与する
カテゴリーツリー状の配列を作成.
ツリーの親子をつなげるルーチン.
配列のキーをIDにした配列を作成.
階層情報が含まれている配列から親ID配列を取得する.
ベースとなるパスと相対パスを比較してファイルが存在する事をチェックする
マイクロ秒付きの時間文字列を取得する.
Details
at line 38
static
sfInitInstall()
at line 59
static string
getInstallerPath()
インストーラーの URL を返す
at line 92
static string
getRealURL(string $url)
相対パスで記述された URL から絶対パスの URL を取得する.
この関数は, http(s):// から始まる URL を解析し, 相対パスで記述されていた 場合, 絶対パスに変換して返す
例) http://www.example.jp/aaa/../index.php ↓ http://www.example.jp/index.php
at line 117
static
sfErrorHeader($mess, $print = false)
at line 129
static
sfDispError($type)
at line 139
static
sfDispSiteError($type, $objSiteSess = '', $return_top = false, $err_msg = '')
at line 157
sfDispException($debugMsg = null)
deprecated
deprecated
前方互換用
at line 170
static bool
sfIsSuccess(Session $objSess, bool $disp_error = true)
認証の可否判定
at line 208
static string
sfPassLen(string $passlen)
文字列をアスタリスクへ変換する.
at line 224
static bool
sfIsHTTPS()
HTTPSかどうかを判定
at line 244
sfIsValidTransition(obj $objSess)
正規の遷移がされているかを判定 前画面でuniqidを埋め込んでおく必要がある
使用されていない.
at line 256
static
sfGetTimestamp($year, $month, $day, $last = false)
at line 280
static
sfGetTimestampistime($year, $month, $day, $hour, $minutes, $last = false)
at line 304
static bool
sfIsInt($value)
INT型の数値チェック ・FIXME: マイナス値の扱いが不明確 ・XXX: INT_LENには収まるが、INT型の範囲を超えるケースに対応できないのでは?
@param mixed $value
at line 319
static boolean
sfIsZeroFilling(string $value)
桁が0で埋められているかを判定する
at line 331
static
sfGetCSVData($data, $prefix = '')
at line 350
static
sfUpDirName()
at line 363
sfMergeCBValue($keyname, $max)
deprecated
deprecated
at line 382
sfMergeCheckBoxes($array, $max)
deprecated
deprecated
at line 406
sfMergeParamCheckBoxes($array)
deprecated
deprecated
at line 428
sfSearchCheckBoxes($array)
deprecated
deprecated
at line 446
sfSplitCheckBoxes($val)
deprecated
deprecated
at line 463
sfMergeCBSearchValue($keyname, $max)
deprecated
deprecated
at line 482
sfSplitCBValue($val, $keyname = '')
deprecated
deprecated
at line 505
static
sfArrKeyValue($arrList, $keyname, $valname, $len_max = '', $keysize = '')
at line 535
sfArrKeyValues($arrList, $keyname, $valname, $len_max = '', $keysize = '', $connect = '')
キーと値をセットした配列を取得(値が複数の場合) 使用されていない
at line 563
static
sfGetCommaList($array, $space = true, $arrPop = array())
at line 590
static
sfGetCSVList($array)
at line 617
sfCheckSetTerm($start_year, $start_month, $start_day, $end_year, $end_month, $end_day)
checksetterm 年月日に別れた2つの期間の妥当性をチェックし、整合性と期間を返す 引数 (開始年,開始月,開始日,終了年,終了月,終了日) 戻値 array(1,2,3) 1.開始年月日 (YYYY/MM/DD 000000) 2.終了年月日 (YYYY/MM/DD 235959) 3.エラー (0 = OK, 1 = NG)
使用されていない
at line 641
sfSetErrorStyle()
at line 647
sfSearchKey($array, $word, $default)
at line 658
sfGetErrorColor($val)
at line 667
sfGetEnabled($val)
at line 676
sfGetChecked($param, $value)
at line 685
sfTrim($str)
at line 704
static double
sfTax(integer $price, integer $tax, integer $tax_rule)
税金額を返す
・店舗基本情報に基づいた計算は \Eccube\Helper\Application::alias('eccube.helper.db')->tax() を使用する
at line 724
static double
sfCalcIncTax(integer $price, integer $tax, integer $tax_rule)
税金付与した金額を返す
・店舗基本情報に基づいた計算は \Eccube\Helper\Application::alias('eccube.helper.db')->tax() を使用する
at line 734
sfRound($value, $pow)
桁数を指定して四捨五入
使用されていない
at line 756
static double
sfPrePoint(int $price, float $point_rate, int $rule = POINT_RULE)
ポイント付与 $product_id が使われていない。
at line 766
static
sfGetClassCatCount()
at line 789
static int
sfGetProductClassId(int $product_id, int $classcategory_id1, int $classcategory_id2)
商品IDとカテゴリIDから商品規格IDを取得する
at line 806
static
sfTrimURL($url)
at line 814
sfDispDBDate($dbdate, $time = true)
at line 838
static array
sfSwapArray(array $array, bool $isColumnName = true)
配列をキー名ごとの配列に変更する
at line 865
static array
getHash2Array(array $hash, array $requires = array())
連想配列から新たな配列を生成して返す.
$requires が指定された場合, $requires に含まれるキーの値のみを返す.
at line 885
sfMultiply($num1, $num2)
at line 900
static integer
getAddPoint(integer $totalpoint, integer $use_point, integer $point_rate)
加算ポイントの計算
・店舗基本情報に基づいた計算は \Eccube\Helper\Application::alias('eccube.helper.db')->getAddPoint() を使用する
at line 913
static
sfGetUniqRandomId($head = '')
at line 929
static string
sfRmDupSlash(string $istr)
二回以上繰り返されているスラッシュ[/]を一つに変換する。
at line 964
static string
sfEncodeFile(string $filepath, string $enc_type, string $out_dir)
テキストファイルの文字エンコーディングを変換する.
$filepath に存在するテキストファイルの文字エンコーディングを変換する. 変換前の文字エンコーディングは, mbdetectorder で設定した順序で自動検出する. 変換後は, 変換前のファイル名に「enc」というプレフィクスを付与し, $outdir で指定したディレクトリへ出力する
TODO $filepath のファイルがバイナリだった場合の扱い TODO fwrite などでのエラーハンドリング
at line 992
sfCutString($str, $len, $byte = true, $commadisp = true)
at line 1042
static
sfTermMonth($year, $month, $close_day)
at line 1085
static
sfMakeHiddenArray($arrSrc, $arrDst = array(), $parent_key = '')
at line 1106
static
sfDBDatetoTime($db_date)
at line 1119
sfMbConvertEncoding($str, $encode = CHAR_CODE)
PHPのmbconvertencoding関数をSmartyでも使えるようにする
XXX この関数を使っている箇所は、ほぼ設計誤りと思われる。変数にフェッチするか、出力時のエンコーディングで対応すべきと見受ける。
at line 1125
sfArrCombine($arrKeys, $arrValues)
at line 1147
static
sfGetUnderChildrenArray($arrData, $pid_name, $id_name, $parent)
at line 1166
static
sfQuoteSmart($in)
deprecated
deprecated
SQLシングルクォート対応
at line 1180
static
sfMakeDir($path)
at line 1214
static
sfCopyDir($src, $des, $mess = '', $override = false)
at line 1275
static void
sfFlush(boolean|string $output = false, int $sleep)
ブラウザに強制的に送出する
at line 1302
sfGetFileVersion($path)
at line 1331
array
mbConvertKanaWithArray(array $array, array $arrConvList)
$array の要素を $arrConvList で指定した方式で mbconvertkana を適用する.
使用されていない
at line 1349
static array
arrayDefineIndexes(array $array, string[] $defineIndexes)
配列の添字が未定義の場合は空文字を代入して定義する.
at line 1367
static array
sfArrayIntersectKeys(array $arrSrc, array $arrKey)
$arrSrc のうち、キーが $arrKey に含まれるものを返す
$arrSrc に含まない要素は返されない。
at line 1382
printXMLDeclaration()
deprecated
deprecated
前方互換用
at line 1396
string
getTableTag(array $array)
配列をテーブルタグで出力する。
使用されていない
at line 1424
static string
getSaveImagePath($filename)
指定の画像のパスを返す
at line 1442
string
sfNoImageMainList(string $filename = '')
一覧-メイン画像のファイル指定がない場合、専用の画像ファイルに書き換える。
at line 1457
static string
sfNoImageMain(string $filename = '')
詳細-メイン画像のファイル指定がない場合、専用の画像ファイルに書き換える。
at line 1472
static void
sfPrintR(mixed $obj)
デバッグ用
at line 1488
static string
sfGetRandomString(integer $length = 1)
ランダムな文字列を取得する
at line 1498
sfGetUrl()
deprecated
deprecated
前方互換用
at line 1510
sfBacktraceToString($arrBacktrace)
deprecated
deprecated
前方互換用
at line 1522
sfIsAdminFunction()
deprecated
deprecated
前方互換用
at line 1534
sfIsFrontFunction()
deprecated
deprecated
前方互換用
at line 1546
sfIsInstallFunction()
deprecated
deprecated
前方互換用
at line 1558
static
sfGetAddress(string $zipcode)
at line 1605
sfMicrotimeFloat()
deprecated
deprecated
前方互換用
at line 1633
static boolean
isBlank(mixed $val, boolean $greedy = true)
変数が空白かどうかをチェックする.
引数 $val が空白かどうかをチェックする. 空白の場合は true. 以下の文字は空白と判断する. - ' ' (ASCII 32 (0x20)), 通常の空白 - "\t" (ASCII 9 (0x09)), タブ - "\n" (ASCII 10 (0x0A)), リターン - "\r" (ASCII 13 (0x0D)), 改行 - "\0" (ASCII 0 (0x00)), NULバイト - "\x0B" (ASCII 11 (0x0B)), 垂直タブ
引数 $val が配列の場合は, 空の配列の場合 true を返す.
引数 $greedy が true の場合は, 全角スペース, ネストした空の配列も 空白と判断する.
at line 1678
static boolean
sfIsInternalDomain(string $url)
指定されたURLのドメインが一致するかを返す
戻り値:一致(true) 不一致(false)
at line 1701
static string
sfGetHashString(string $str, string $salt)
パスワードのハッシュ化
at line 1723
static boolean
sfIsMatchHashPassword(string $pass, string $hashpass, string $salt)
パスワード文字列のハッシュ一致判定
at line 1756
static integer
sfGetSearchPageMax(string $search_page_max)
検索結果の1ページあたりの最大表示件数を取得する
フォームの入力値から最大表示件数を取得する 取得できなかった場合は, 定数 SEARCH_PMAX の値を返す
at line 1779
static string
jsonEncode(mixed $value)
値を JSON 形式にして返す.
この関数は, jsonencode() 又は ServicesJSON::encode() のラッパーです. jsonencode() 関数が使用可能な場合は jsonencode() 関数を使用する. 使用できない場合は, Services_JSON::encode() 関数を使用する.
at line 1804
static mixed
jsonDecode(string $json)
JSON 文字列をデコードする.
この関数は, jsondecode() 又は ServicesJSON::decode() のラッパーです. jsondecode() 関数が使用可能な場合は jsondecode() 関数を使用する. 使用できない場合は, Services_JSON::decode() 関数を使用する.
at line 1829
static boolean
isAbsoluteRealPath(string $path)
パスが絶対パスかどうかをチェックする.
引数のパスが絶対パスの場合は true を返す. この関数は, パスの存在チェックを行なわないため注意すること.
use FileUtil::isAbsolute http://pear.php.net/package/FileUtil/
at line 1848
static boolean
recursiveMkdir($path, $mode = 0777)
ディレクトリを再帰的に作成する.
at line 1854
static
isAppInnerUrl($url)
at line 1869
static boolean
extendTimeOut(integer $seconds = null)
PHP のタイムアウトを延長する
ループの中で呼び出すことを意図している。 暴走スレッドが残留する確率を軽減するため、settimelimit(0) とはしていない。
at line 1891
static void
clearCompliedTemplate()
コンパイルファイルを削除します.
at line 1906
static void
copyDirectory(string $source_path, string $dest_path)
指定されたパスの配下を再帰的にコピーします.
at line 1932
static string
repeatStrWithSeparator(string $input, string $multiplier, string $separator = ',')
文字列を区切り文字を挟み反復する
at line 1944
static string
encodeRFC3986(string $str)
RFC3986に準拠したURIエンコード MEMO: PHP5.3.0未満では、~のエンコードをしてしまうための処理
at line 1956
static string
trim(string $str, string $charlist = null)
マルチバイト対応の trim
at line 1970
static string
ltrim(string $str, string $charlist = null)
マルチバイト対応の ltrim
at line 1984
static string
rtrim(string $str, string $charlist = null)
マルチバイト対応の rtrim
at line 1997
static string
getTrimPregPattern(string $charlist = null)
文字列のトリム処理で使用する PCRE のパターン
at line 2012
static string
getUnitDataSize(int $data)
データ量の単位を付与する
at line 2035
static array
buildTree(string $primary_key, string $glue_key, integer $max_depth, array $correction = array(), integer $root_id)
カテゴリーツリー状の配列を作成.
at line 2059
static void
addChild(array $target, string $primary_key, integer $level, integer $max_depth, array $children = array())
ツリーの親子をつなげるルーチン.
at line 2078
static array
makeArrayIDToKey(string $ID_name, array $correction = array())
配列のキーをIDにした配列を作成.
at line 2102
static array
getTreeTrail(integer $start_id, string $primary_key, string $glue_key, array $correction = array(), boolean $cid_is_key = FALSE, integer $root_id, boolean $id_only = TRUE)
階層情報が含まれている配列から親ID配列を取得する.
at line 2134
static bool
checkFileExistsWithInBasePath(string $file, string $base_path)
ベースとなるパスと相対パスを比較してファイルが存在する事をチェックする
at line 2147
static string
getFormattedDateWithMicroSecond()
マイクロ秒付きの時間文字列を取得する.