HTML and CSS Reference
In-Depth Information
$uri_array = explode('/', $real_uri);
// If the first element is empty, get rid of it
if (empty($uri_array[0])) {
array_shift($uri_array);
}
// If the last element is empty, get rid of it
if (empty($uri_array[count($uri_array)-1])) {
array_pop($uri_array);
}
return $uri_array;
}
/**
* Determines the controller name using the first element of the URI array
*
* @param $uri_array array The broken up URI
* @return string The controller classname
*/
function get_controller_classname( &$uri_array )
{
$controller = array_shift($uri_array);
return ucfirst($controller);
}
/**
* Removes unwanted slashes (except in the protocol)
*
* @param $dirty_path string The path to check for unwanted slashes
* @return string The cleaned path
*/
function remove_unwanted_slashes( $dirty_path )
{
return preg_replace('~(?<!:)//~', '/', $dirty_path);
}
/**
* Autoloads classes as they are instantiated
*
* @param $class_name string The name of the class to be loaded
* @return bool Returns TRUE on success (Exception on failure)
*/
function class_autoloader( $class_name )
{
$fname = strtolower($class_name);
 
Search WWH ::




Custom Search