From e9b8c8f8df071f757ef9616076859744c5db5844 Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Tue, 13 Jan 2015 13:24:23 +0200 Subject: [PATCH] cleanup --- ipf/utils.php | 94 --------------------------------------------------- 1 file changed, 94 deletions(-) diff --git a/ipf/utils.php b/ipf/utils.php index c0ff2f1..d1b33f3 100644 --- a/ipf/utils.php +++ b/ipf/utils.php @@ -106,32 +106,6 @@ class IPF_Utils return $string; } - public static function formatDate($str, $format='Y-m-d H:i:s', $tz=null) - { - if (!$tz) - $tz = IPF::get('time_zone'); - $date = new DateTime($str, new DateTimeZone('UTC')); - $date->setTimeZone(new DateTimeZone($tz)); - return gmdate($format, $date->format('U') + $date->getOffset()); - } - - static function dateCompare($date1, $date2=null) - { - if (strlen($date1) == 10) { - $date1 .= ' 23:59:59'; - } - if (is_null($date2)) { - $date2 = time(); - } else { - if (strlen($date2) == 10) { - $date2 .= ' 23:59:59'; - } - $date2 = strtotime(str_replace('-', '/', $date2)); - } - $date1 = strtotime(str_replace('-', '/', $date1)); - return $date2 - $date1; - } - public static function insertDirectory($path, $directory) { $parts = pathinfo($path); @@ -196,73 +170,5 @@ class IPF_Utils $dir->close(); return true; } - - public static function print_r($subject, $ignore = array(), $depth = 5, $refChain = array()) - { - $s = ''; - if ($depth > 20) return; - if (is_object($subject)) { - foreach ($refChain as $refVal) - if ($refVal === $subject) { - $s .= "*RECURSION*\n"; - return; - } - array_push($refChain, $subject); - $s .= get_class($subject) . " Object ( \n"; - $subject = (array) $subject; - foreach ($subject as $key => $val) - if (is_array($ignore) && !in_array($key, $ignore, 1)) { - $s .= str_repeat(" ", $depth * 4) . '['; - if ($key{0} == "\0") { - $keyParts = explode("\0", $key); - $s .= $keyParts[2] . (($keyParts[1] == '*') ? ':protected' : ':private'); - } else - $s .= $key; - $s .= '] => '; - IPF_Utils::print_r($val, $ignore, $depth + 1, $refChain); - } - $s .= str_repeat(" ", ($depth - 1) * 4) . ")\n"; - array_pop($refChain); - } elseif (is_array($subject)) { - $s .= "Array ( \n"; - foreach ($subject as $key => $val) - if (is_array($ignore) && !in_array($key, $ignore, 1)) { - $s .= str_repeat(" ", $depth * 4) . '[' . $key . '] => '; - IPF_Utils::print_r($val, $ignore, $depth + 1, $refChain); - } - $s .= str_repeat(" ", ($depth - 1) * 4) . ")\n"; - } else - $s .= $subject . "\n"; - return $s; - } - - public static function timestamp() - { - list($f,$i) = explode(' ',microtime()); - return $i.substr((string)$f,2,6); - } - - static function TrimP($html) - { - $strL = "

"; $lenL = 3; - $strR = "

"; $lenR = 4; - if (0 == strcasecmp(substr($html, 0, $lenL), $strL) - && 0 == strcasecmp(substr($html, -$lenR), $strR)){ - return substr($html, $lenL, strlen($html) - ($lenL + $lenR)); - } - return $html; - } - - static function moneyFormat($val) - { - return number_format((float)$val,2); - } - - static function toSlug($slug) - { - if ($slug) - return strtolower(preg_replace('/[^A-Z^a-z^0-9^\/\_]+/', '-', $slug)); - return $slug; - } } -- 2.49.0