normalizeURL() public static method

Normalizes a URL to an absolute URL and validate it. In addition to resolving the URL, this function makes sure that it is a link to an http or https site.
Author: Olav Morken, UNINETT AS (olav.morken@uninett.no)
Author: Jaime Perez, UNINETT AS (jaime.perez@uninett.no)
public static normalizeURL ( string $url ) : string
$url string The relative URL.
return string An absolute URL for the given relative URL.
Example #1
0
<?php

require_once '_include.php';
$config = SimpleSAML_Configuration::getInstance();
if (array_key_exists('link_href', $_REQUEST)) {
    $link = (string) $_REQUEST['link_href'];
    $link = \SimpleSAML\Utils\HTTP::normalizeURL($link);
} else {
    $link = 'index.php';
}
if (array_key_exists('link_text', $_REQUEST)) {
    $text = $_REQUEST['link_text'];
} else {
    $text = '{logout:default_link_text}';
}
$t = new SimpleSAML_XHTML_Template($config, 'logout.php');
$t->data['link'] = $link;
$t->data['text'] = $text;
$t->show();
exit;
Example #2
0
 /**
  * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::normalizeURL() instead.
  */
 public static function normalizeURL($url)
 {
     return \SimpleSAML\Utils\HTTP::normalizeURL($url);
 }
Example #3
0
<?php

if (isset($_REQUEST['retryURL'])) {
    $retryURL = (string) $_REQUEST['retryURL'];
    $retryURL = \SimpleSAML\Utils\HTTP::normalizeURL($retryURL);
} else {
    $retryURL = NULL;
}
$globalConfig = SimpleSAML_Configuration::getInstance();
$t = new SimpleSAML_XHTML_Template($globalConfig, 'core:no_cookie.tpl.php');
$t->data['retryURL'] = $retryURL;
$t->show();