Revision: 1723 Author: olavmrk Date: Fri Aug 28 00:47:12 2009 Log: SimpleSAML_Utilities: Add getBaseURL function.
This function returns the absolute URL to the base of the simpleSAMLphp installation, and should be used instead of: SimpleSAML_Utilities::selfURLhost() . '/' . $config->getBaseURL() http://code.google.com/p/simplesamlphp/source/detail?r=1723 Modified: /trunk/lib/SimpleSAML/Utilities.php ======================================= --- /trunk/lib/SimpleSAML/Utilities.php Thu Aug 27 02:32:13 2009 +++ /trunk/lib/SimpleSAML/Utilities.php Fri Aug 28 00:47:12 2009 @@ -150,6 +150,29 @@ return $requesturi; } + + + /** + * Retrieve the absolute base URL for the simpleSAMLphp installation. + * + * This function will return the absolute base URL for the simpleSAMLphp + * installation. For example: https://idp.example.org/simplesaml/ + * + * The URL will always end with a '/'. + * + * @return string The absolute base URL for the simpleSAMLphp installation. + */ + public static function getBaseURL() { + + $globalConfig = SimpleSAML_Configuration::getInstance(); + $ret = SimpleSAML_Utilities::selfURLhost() . '/' . $globalConfig->getBaseURL(); + if (substr($ret, -1) !== '/') { + throw new SimpleSAML_Error_Exception('Invalid value of \'baseurl\' in ' . + 'config.php. It must end with a \'/\'.'); + } + + return $ret; + } /** --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "simpleSAMLphp commits" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/simplesamlphp-commits?hl=en -~----------~----~----~----~------~----~------~--~---
