minor tweaks and optimizations to URI library

Some tweaks and optimizations:
1) rename variable $uri to $protocol for better self-documented code
2) minimize function calls to $this->config->item() by storing value in $protocol
3) use PHP_SAPI constant instead of php_sapi_name()