resolveURL() public static method

This function supports these forms of relative URLs: - ^\w+: Absolute URL. E.g. "http://www.example.com:port/path?query#fragment". - ^// Same protocol. E.g. "//www.example.com:port/path?query#fragment" - ^/ Same protocol and host. E.g. "/path?query#fragment". - ^? Same protocol, host and path, replace query string & fragment. E.g. "?query#fragment". - ^# Same protocol, host, path and query, replace fragment. E.g. "#fragment". - The rest: Relative to the base path.
Author: Olav Morken, UNINETT AS (olav.morken@uninett.no)
Author: Jaime Perez, UNINETT AS (jaime.perez@uninett.no)
public static resolveURL ( string $url, string $base = null ) : string
$url string The relative URL.
$base string The base URL. Defaults to the base URL of this installation of SimpleSAMLphp.
return string An absolute URL for the given relative URL.
Example #1
0
function showEntry($t, $metadata, $favourite = FALSE)
{
    $basequerystring = '?' . 'entityID=' . urlencode($t->data['entityID']) . '&' . 'return=' . urlencode($t->data['return']) . '&' . 'returnIDParam=' . urlencode($t->data['returnIDParam']) . '&idpentityid=';
    $extra = $favourite ? ' favourite' : '';
    $html = '<a class="metaentry' . $extra . '" href="' . $basequerystring . urlencode($metadata['entityid']) . '">';
    $html .= '' . htmlspecialchars(getTranslatedName($t, $metadata)) . '';
    if (array_key_exists('icon', $metadata) && $metadata['icon'] !== NULL) {
        $iconUrl = \SimpleSAML\Utils\HTTP::resolveURL($metadata['icon']);
        $html .= '<img alt="Icon for identity provider" class="entryicon" src="' . htmlspecialchars($iconUrl) . '" />';
    }
    $html .= '</a>';
    return $html;
}
Example #2
0
 /**
  * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::resolveURL() instead.
  */
 public static function resolveURL($url, $base = NULL)
 {
     return \SimpleSAML\Utils\HTTP::resolveURL($url, $base);
 }
    echo '<div class="preferredidp">';
    echo '	<img src="/' . $this->data['baseurlpath'] . 'resources/icons/experience/gtk-about.64x64.png" class="float-r" alt="' . $this->t('icon_prefered_idp') . '" />';
    if (array_key_exists('icon', $idpentry) && $idpentry['icon'] !== NULL) {
        $iconUrl = \SimpleSAML\Utils\HTTP::resolveURL($idpentry['icon']);
        echo '<img class="float-l" style="margin: 1em; padding: 3px; border: 1px solid #999" src="' . htmlspecialchars($iconUrl) . '" />';
    }
    echo "\n" . '	<h3 style="margin-top: 8px">' . htmlspecialchars($this->t('idpname_' . $idpentry['entityid'])) . '</h3>';
    if (!empty($idpentry['description'])) {
        echo '	<p>' . htmlspecialchars($this->t('idpdesc_' . $idpentry['entityid'])) . '<br />';
    }
    echo '<input id="preferredidp" type="submit" name="idp_' . htmlspecialchars($idpentry['entityid']) . '" value="' . $this->t('select') . '" /></p>';
    echo '</div>';
}
foreach ($this->data['idplist'] as $idpentry) {
    if ($idpentry['entityid'] != $this->data['preferredidp']) {
        if (array_key_exists('icon', $idpentry) && $idpentry['icon'] !== NULL) {
            $iconUrl = \SimpleSAML\Utils\HTTP::resolveURL($idpentry['icon']);
            echo '<img class="float-l" style="clear: both; margin: 1em; padding: 3px; border: 1px solid #999" src="' . htmlspecialchars($iconUrl) . '" />';
        }
        echo "\n" . '	<h3 style="margin-top: 8px">' . htmlspecialchars($this->t('idpname_' . $idpentry['entityid'])) . '</h3>';
        if (!empty($idpentry['description'])) {
            echo '	<p>' . htmlspecialchars($this->t('idpdesc_' . $idpentry['entityid'])) . '<br />';
        }
        echo '<input type="submit" name="idp_' . htmlspecialchars($idpentry['entityid']) . '" value="' . $this->t('select') . '" /></p>';
    }
}
?>
		</form>
		
<?php 
$this->includeAtTemplateBase('includes/footer.php');