Refactoring.

This commit is contained in:
Lars Jung 2014-05-14 14:27:38 +02:00
parent b67c22f33b
commit fc8a0589dd
6 changed files with 99 additions and 62 deletions

View file

@ -1,5 +1,11 @@
<?php
function normalize_path($path, $trailing_slash = false) {
$path = str_replace("\\", "/", $path);
return preg_match("#^(\w:)?/$#", $path) ? $path : (rtrim($path, "/") . ($trailing_slash ? "/" : ""));
}
function json_exit($obj = array()) {
$obj["code"] = 0;
@ -15,6 +21,11 @@ function json_fail($code, $msg = "", $cond = true) {
}
}
function has_request_param($key) {
return array_key_exists($key, $_REQUEST);
}
function use_request_params($keys) {
if (!is_array($keys)) {