All pastes #551375 Raw Edit

Someone

public php v1 · immutable
·published 2007-06-08 19:39 UTC
rendered paste body
<?php// Function getPathElements// {	// Name: getPathElements	// Args: array getPathElements()	// Desc: Returns an array over the processed path.	// BeginCode	function getPathElements()	{		// Get the raw data.		$path = $_GET['r'];		if((empty($path)) === true)			$path = 'index';		// Remove unwanted chars.		if($path[0] == '/')			$path = ltrim($path, '/');		$last = (strlen($path) - 1);		if($path[$last] == '/')			$path = rtrim($path, '/');		// Make the string to an array.		$pathExtra = explode('/', $path);		unset($path);		// Check all the route one more time.		$max = count($pathExtra);		for($i = 0; $i < $max; $i++):			if(preg_match('/[a-zA-Z0-9.+_-]+/', $pathExtra[$i]) == 0)				unset($pathExtra[$i]);			else				$path[] = $pathExtra[$i];		endfor;				return $path;	}	// EndCode// }?>