File: D:/HostingSpaces/SBogers10/lab.komma-mediadesign.nl/wwwroot/lab/lib/functions.class.php
<?php
/**
* functions.class.php
* Created by Komma Mediadesign.
* Author: mike
* Date: 3/20/13
*/
class Functions {
/*
* @property array errors
* If a functions returns an error, it will be saved in this value.
* You can access this array by calling Functions::getErrors();
*/
private $_errors = array();
public function __construct(){ }
/**
* Converts string into url string.
*
* @access public
* @param string
* @return string
*/
public function encodeUrl($input)
{
$output = trim($input);
$output = str_replace(' ','-',$output);
$output = str_replace('---','-',$output);
$output = str_replace('--','-',$output);
//remove these characters
$forbidden = array("'", '"', '\\', '/', ';', ';', '|', '>', '<', '[', ']', '!','?', '@', '#', '$', '%', '^', '&', '*', '(', ')','+','=','{','}','`', '~', '.', ',');
foreach($forbidden as $key => $value){
$output = str_replace($value, '', $output);
}
$output = strtolower($output);
return $output;
}
/*
* Headers a 404 error
*/
function notFound()
{
header("HTTP/1.0 404 Not Found");
header('location:'.SITE_ROOT.'404/');
exit;
}
/*
* Redirect to a page
*/
function redirect($url)
{
header('location:' . $url);
exit;
}
/*
* Returns the errors in an array
*/
public function getErrors()
{
return $this->_errors;
}
}