return false;
return true;
}
-
+
public static function isEmail($value){
$qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]';
$dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]';
$addrSpec = "$localPart\\x40$domain";
return (bool) preg_match("!^$addrSpec$!D", $value);
}
-
+
static function prettySize($size)
{
$mb = 1024*1024;
}
return $mysize;
}
-
+
static function cleanFileName($name, $path)
{
$name = mb_strtolower($name, 'UTF-8');
}
return $name;
}
-
+
static function isValidUrl($url)
{
$ip = '(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.'
$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)));
}
{
$string = '';
$chars = '0123456789abcdefghijklmnopqrstuvwxyz'
- .'ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%&*()+=-_}{[]><?/';
+ .'ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%&*()+=-_}{[]><?/';
$lchars = strlen($chars);
- $i = 0;
- while ($i<$len) {
+ $i = 0;
+ while ($i<$len) {
$string .= substr($chars, mt_rand(0, $lchars-1), 1);
$i++;
}
return $string;
}
-
+
static function dateCompare($date1, $date2=null)
{
if (strlen($date1) == 10){
$date1 = strtotime(str_replace('-', '/', $date1));
return $date2 - $date1;
}
-
+
static function appLabelByModel($model){
foreach (IPF_Project::getInstance()->appList() as $app){
foreach($app->modelList() as $m){
}
return '';
}
-
+
public static function makeDirectories($path, $mode = 0777){
if ( ! $path) {
return false;
}
return mkdir(trim($path), $mode, true);
}
-
+
public static function removeDirectories($folderPath){
if (is_dir($folderPath)){
foreach (scandir($folderPath) as $value){
$dir->close();
return true;
}
-
+
public static function print_r($subject, $ignore = array(), $depth = 5, $refChain = array())
{
$s = '';
$s .= $subject . "\n";
return $s;
}
-
+
+ public static function timestamp(){
+ list($f,$i) = split(' ',microtime());
+ return $i.substr((string)$f,2,6);
+ }
}