allowedChars); return $value; } /** * transfers/removes all < > from text (remove TRUE/FALSE) * * 2009-07-07 ms */ public static function htmlDeep($value) { $value = is_array($value) ? array_map('self::htmlDeep', $value) : Sanatize::html($value, $this->removeChars); return $value; } /** * main deep method * * 2009-07-07 ms */ public static function deep($function, $value) { $value = is_array($value) ? array_map('self::' . $function, $value) : $function($value); return $value; } /** * Flattens an array, or returns FALSE on fail. * 2011-07-02 ms */ public static function arrayFlatten($array) { if (!is_array($array)) { return false; } $result = array(); foreach ($array as $key => $value) { if (is_array($value)) { $result = array_merge($result, self::arrayFlatten($value)); } else { $result[$key] = $value; } } return $result; } /** * @param array $keyValuePairs * @return string $key * like array_shift() only for keys and not values * 2011-01-22 ms */ public static function arrayShiftKeys(&$array) { foreach ($array as $key => $value) { unset($array[$key]); return $key; } } protected static $_counterStartTime; /** * returns microtime as float value * (to be subtracted right away) * @static * 2009-07-07 ms */ public static function microtime($precision = 8) { return round(microtime(true), $precision); } /** * @return void * 2009-07-07 ms */ public static function startClock() { self::$_counterStartTime = self::microtime(); } /** * @static * 2009-07-07 ms */ public static function returnElapsedTime($precision = 8, $restartClock = false) { $startTime = self::$_counterStartTime; if ($restartClock) { self::startClock(); } return self::calcElapsedTime($startTime, self::microtime(), $precision); } /** * returns microtime as float value * (to be subtracted right away) * @static * 2009-07-07 ms */ public static function calcElapsedTime($start, $end, $precision = 8) { $elapsed = $end - $start; return round($elapsed, $precision); } }