src/core/ToolBox.class.php
static public function clean_url($url=NULL) {
		//make sure we've still got something valid to work with.
		if(strlen($url)) {
			//if there's an "APPURL" constant, drop that from the url.
			if(defined('APPURL') && strlen(constant('APPURL'))) {
				$dropThis = preg_replace('/^\//', '', constant('APPURL'));
				$dropThis = preg_replace('/\//', '\\/', $dropThis);
				$url = preg_replace('/^'. $dropThis .'/', '', $url);
			}
			
			//check the string to make sure it doesn't begin with a "/"
			if($url[0] == '/') {
				$url = substr($url, 1, strlen($url));
			}
	
			//check the last char for a "/"...
			if($url[strlen($url) -1] == '/') {
				//last char is a '/'... kill it.
				$url = substr($url, 0, strlen($url) -1);
			}
	
			//if we've been sent a query, kill it off the string...
			if(preg_match('/\?/', $url)) {
				$url = preg_split('/\?/', $url);
				$url = $url[0];
			}
	
			if(preg_match("/\./", $url)) {
				//disregard file extensions, but keep everything else...
				//	i.e. "index.php/yermom.html" becomes "index/yermom"
				$tArr = explode('/', $url);
				$tUrl = null;
				foreach($tArr as $tUrlPart) {
					$temp = explode(".", $tUrlPart);
					if(strlen($temp[0])) {
						$tUrlPart = $temp[0];
					}
					$tUrl = ToolBox::create_list($tUrl, $tUrlPart, '/');
				}
				$url = $tUrl;
			}
		}
		else {
			$url = null;
		}

		return($url);
	}
static public function clean_url($url=NULL) {
		//make sure we've still got something valid to work with.
		if(strlen($url)) {
			//if there's an "APPURL" constant, drop that from the url.
			if(defined('APPURL') && strlen(constant('APPURL'))) {
				$dropThis = preg_replace('/^\//', '', constant('APPURL'));
				$dropThis = preg_replace('/\//', '\\/', $dropThis);
				$url = preg_replace('/^'. $dropThis .'/', '', $url);
			}
			
			//check the string to make sure it doesn't begin with a "/"
			if($url[0] == '/') {
				$url = substr($url, 1, strlen($url));
			}
	
			//check the last char for a "/"...
			if($url[strlen($url) -1] == '/') {
				//last char is a '/'... kill it.
				$url = substr($url, 0, strlen($url) -1);
			}
	
			//if we've been sent a query, kill it off the string...
			if(preg_match('/\?/', $url)) {
				$url = preg_split('/\?/', $url);
				$url = $url[0];
			}
	
			if(preg_match("/\./", $url)) {
				//disregard file extensions, but keep everything else...
				//	i.e. "index.php/yermom.html" becomes "index/yermom"
				$tArr = explode('/', $url);
				$tUrl = null;
				foreach($tArr as $tUrlPart) {
					$temp = explode(".", $tUrlPart);
					if(strlen($temp[0])) {
						$tUrlPart = $temp[0];
					}
					$tUrl = ToolBox::create_list($tUrl, $tUrlPart, '/');
				}
				$url = $tUrl;
			}
		}
		else {
			$url = null;
		}

		return($url);
	}
static public function clean_url ( $ url = NULL ) { //make sure we've still got something valid to work with. if ( strlen ( $ url ) ) { //if there's an "APPURL" constant, drop that from the url. if ( defined ( 'APPURL' ) && strlen ( constant ( 'APPURL' ) ) ) { $ dropThis = preg_replace ( '/^\//' , '' , constant ( 'APPURL' ) ) ; $ dropThis = preg_replace ( '/\//' , '\\/' , $ dropThis ) ; $ url = preg_replace ( '/^' . $ dropThis . '/' , '' , $ url ) ; } //check the string to make sure it doesn't begin with a "/" if ( $ url [ 0 ] == '/' ) { $ url = substr ( $ url , 1 , strlen ( $ url ) ) ; } //check the last char for a "/"... if ( $ url [ strlen ( $ url ) - 1 ] == '/' ) { //last char is a '/'... kill it. $ url = substr ( $ url , 0 , strlen ( $ url ) - 1 ) ; } //if we've been sent a query, kill it off the string... if ( preg_match ( '/\?/' , $ url ) ) { $ url = preg_split ( '/\?/' , $ url ) ; $ url = $ url [ 0 ] ; } if ( preg_match ( "/\./" , $ url ) ) { //disregard file extensions, but keep everything else... //	i.e. "index.php/yermom.html" becomes "index/yermom" $ tArr = explode ( '/' , $ url ) ; $ tUrl = null ; foreach ( $ tArr as $ tUrlPart ) { $ temp = explode ( "." , $ tUrlPart ) ; if ( strlen ( $ temp [ 0 ] ) ) { $ tUrlPart = $ temp [ 0 ] ; } $ tUrl = ToolBox :: create_list ( $ tUrl , $ tUrlPart , '/' ) ; } $ url = $ tUrl ; } } else { $ url = null ; } return ( $ url ) ; }
Removes all the crap from the url, so we can figure out what section we
need to load templates & includes for.
Removes all the crap from the url so we can figure out what section we need to load templates & includes for .