All pastes #611617 Raw Edit

k4st

public php v1 · immutable
·published 2007-07-10 00:34 UTC
rendered paste body
	/**	 * Parse the path request variable and derive the	 * page controller from it, then return an array	 * of all of the elements in the path (without the	 * leading controller name). The Path request variable  (index.php?path=) will	 * normally look like a folder path because of .htaccess mod_rewrite	 * @internal	 */	private function parsePath() 	{		// Get the path and then split it up by the /'s		// P.S. explode() does not work in this scenario		// because explode() will get empty elements.				$path = $this->request['path'];		$path = preg_split('~/~', $path, -1, PREG_SPLIT_NO_EMPTY);				// Shift off elements of the array if directories		// in the controller dir exist for this path.						$i = -1;		while(isset($path[++$i])) {			if(is_dir($this->controller_dir . $path[$i])) {				$this->controller_dir .= array_shift($path) . '/';			} else {				break;			}		}				// Figure out what controller function should be 		// used.				$page = empty($path) ? 'index' : array_shift($path);				// Set the info.				$this->page = $page;		$this->path = $path;	}