summaryrefslogtreecommitdiffstats
path: root/lib/SimpleSAML/Module.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/SimpleSAML/Module.php')
-rw-r--r--lib/SimpleSAML/Module.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/SimpleSAML/Module.php b/lib/SimpleSAML/Module.php
index 5ac8c46..18a332b 100644
--- a/lib/SimpleSAML/Module.php
+++ b/lib/SimpleSAML/Module.php
@@ -129,6 +129,23 @@ class SimpleSAML_Module {
return $className;
}
+
+ /**
+ * Get absolute URL to a specified module resource.
+ *
+ * This function creates an absolute URL to a resource stored under ".../modules/<module>/www/".
+ *
+ * @param string $resource Resource path, on the form "<module name>/<resource>"
+ * @return string The absolute URL to the given resource.
+ */
+ public static function getModuleURL($resource) {
+ assert('is_string($resource)');
+ assert('$resource[0] !== "/"');
+
+ $config = SimpleSAML_Configuration::getInstance();
+ return SimpleSAML_Utilities::selfURLhost() . '/' . $config->getBaseURL() . 'module.php/' . $resource;
+ }
+
}
?> \ No newline at end of file