From: avl Date: Sun, 16 Nov 2008 03:13:16 +0000 (+0200) Subject: IPF_Utils::timestamp() X-Git-Tag: 0.5~454 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=f09b4d4e3b016de018ea9931f4d23d545d4208b6;p=ipf.git IPF_Utils::timestamp() --- diff --git a/ipf/utils.php b/ipf/utils.php index 068ff5c..5e6b9b1 100644 --- a/ipf/utils.php +++ b/ipf/utils.php @@ -13,7 +13,7 @@ class IPF_Utils { return false; return true; } - + public static function isEmail($value){ $qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]'; $dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]'; @@ -29,7 +29,7 @@ class IPF_Utils { $addrSpec = "$localPart\\x40$domain"; return (bool) preg_match("!^$addrSpec$!D", $value); } - + static function prettySize($size) { $mb = 1024*1024; @@ -42,7 +42,7 @@ class IPF_Utils { } return $mysize; } - + static function cleanFileName($name, $path) { $name = mb_strtolower($name, 'UTF-8'); @@ -74,7 +74,7 @@ class IPF_Utils { } return $name; } - + static function isValidUrl($url) { $ip = '(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.' @@ -82,7 +82,7 @@ class IPF_Utils { $dom = '([a-z0-9\.\-]+)'; return (preg_match('!^(http|https|ftp|gopher)\://('.$ip.'|'.$dom.')!i', $url)) ? true : false; } - + static function humanTitle($s){ return ucfirst(str_replace('_',' ',str_replace('_id','',$s))); } @@ -91,16 +91,16 @@ class IPF_Utils { { $string = ''; $chars = '0123456789abcdefghijklmnopqrstuvwxyz' - .'ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%&*()+=-_}{[]>appList() as $app){ foreach($app->modelList() as $m){ @@ -127,7 +127,7 @@ class IPF_Utils { } return ''; } - + public static function makeDirectories($path, $mode = 0777){ if ( ! $path) { return false; @@ -137,7 +137,7 @@ class IPF_Utils { } return mkdir(trim($path), $mode, true); } - + public static function removeDirectories($folderPath){ if (is_dir($folderPath)){ foreach (scandir($folderPath) as $value){ @@ -180,7 +180,7 @@ class IPF_Utils { $dir->close(); return true; } - + public static function print_r($subject, $ignore = array(), $depth = 5, $refChain = array()) { $s = ''; @@ -219,6 +219,10 @@ class IPF_Utils { $s .= $subject . "\n"; return $s; } - + + public static function timestamp(){ + list($f,$i) = split(' ',microtime()); + return $i.substr((string)$f,2,6); + } }