school shit
This commit is contained in:
parent
c2d60e216c
commit
1435b8e007
1 changed files with 16 additions and 0 deletions
16
utility.php
16
utility.php
|
@ -3,6 +3,8 @@
|
|||
* A set of utility helper functions
|
||||
*/
|
||||
|
||||
use Phroute\Phroute\Exception\HttpMethodNotAllowedException;
|
||||
use Phroute\Phroute\Exception\HttpRouteNotFoundException;
|
||||
use Sakura\Config;
|
||||
use Sakura\Exceptions\ConfigValueNotFoundException;
|
||||
use Sakura\Net;
|
||||
|
@ -52,6 +54,20 @@ function view($name, $vars = [])
|
|||
return Template::render($name);
|
||||
}
|
||||
|
||||
// Abort response
|
||||
function abort($status = 200)
|
||||
{
|
||||
http_response_code($status);
|
||||
|
||||
switch ($status) {
|
||||
case 403:
|
||||
throw new HttpMethodNotAllowedException;
|
||||
|
||||
case 404:
|
||||
throw new HttpRouteNotFoundException;
|
||||
}
|
||||
}
|
||||
|
||||
function clean_string($string, $lower = false, $noSpecial = false, $replaceSpecial = '')
|
||||
{
|
||||
// Run common sanitisation function over string
|
||||
|
|
Reference in a new issue