$value) $newarray[formatParam($name, $sanitize)] = formatParam($value, $sanitize); return $newarray; } return formatParam($httpRequestInput[$name], $sanitize); } function formatParam($str, $sanitize = false) { if ($sanitize) $str = preg_replace("/[^0-9a-z\-_,]+/i", "", $str); if (ini_get("magic_quotes_gpc")) $str = stripslashes($str); return $str; } function getClassName($obj) { return strtolower(get_class($obj)); } /** * Check if a value is true/false. * * @param string $str True/False value. * @return bool true/false */ function checkBool($str, $def = false) { if ($str === true) return true; if ($str === false) return false; $str = strtolower($str); if ($str == "true") return true; return $def; } /** * Returns a file extention from a path. * * @param string $path Path to grab extention from. * @return string File extention. */ function getFileExt($path) { $ar = explode('.', $path); return strtolower(array_pop($ar)); } /** * Returns the mime type of an path by resolving it agains a apache style "mime.types" file. * * @param String $path path to Map/get content type by * @patam String $mime_File Absolute filepath to mime.types style file. * @return String mime type of path or an empty string on failue. */ function mapMimeTypeFromUrl($path, $mime_file) { if (($fp = fopen($mime_file, "r"))) { $ar = explode('.', $path); $ext = strtolower(array_pop($ar)); while (!feof ($fp)) { $line = fgets($fp, 4096); $chunks = preg_split("/(\t+)|( +)/", $line); for ($i=1; $igetLogger(); if (!$mcLogger) { $mcLogger = new Moxiecode_Logger(); // Set logger options $mcLogger->setPath(dirname(__FILE__) . "/../logs"); $mcLogger->setMaxSize("100kb"); $mcLogger->setMaxFiles("10"); $mcLogger->setFormat("{time} - {message}"); } return $mcLogger; } function debug($msg) { $args = func_get_args(); $log =& getLogger(); $log->debug(implode(', ', $args)); } function info($msg) { $args = func_get_args(); $log =& getLogger(); $log->info(implode(', ', $args)); } function error($msg) { $args = func_get_args(); $log =& getLogger(); $log->error(implode(', ', $args)); } function warn($msg) { $args = func_get_args(); $log =& getLogger(); $log->warn(implode(', ', $args)); } function fatal($msg) { $args = func_get_args(); $log =& getLogger(); $log->fatal(implode(', ', $args)); } ?>