You are here

function _fontawesome_unparse_url in Font Awesome Icons 8.2

Same name and namespace in other branches
  1. 7.3 fontawesome.module \_fontawesome_unparse_url()

Unparses a CDN URL for use with individual Font Awesome file inclusions.

Parameters

array $parsed: Array containing URL parsed data.

Return value

string The unparsed URL for the CDN.

1 call to _fontawesome_unparse_url()
fontawesome_library_info_alter in ./fontawesome.module
Implements hook_library_info_alter().

File

./fontawesome.module, line 146
Drupal integration with Font Awesome, the iconic font for use with Bootstrap.

Code

function _fontawesome_unparse_url(array $parsed) {
  $get = function ($key) use ($parsed) {
    return isset($parsed[$key]) ? $parsed[$key] : NULL;
  };
  $pass = $get('pass');
  $user = $get('user');
  $userinfo = $pass !== NULL ? "{$user}:{$pass}" : $user;
  $port = $get('port');
  $scheme = $get('scheme');
  $query = $get('query');
  $fragment = $get('fragment');
  $authority = ($userinfo !== NULL ? "{$userinfo}@" : '') . $get('host') . ($port ? ":{$port}" : '');
  return (strlen($scheme) ? "{$scheme}:" : '') . (strlen($authority) ? "//{$authority}" : '') . $get('path') . (strlen($query) ? "?{$query}" : '') . (strlen($fragment) ? "#{$fragment}" : '');
}