Guest User

Untitled

a guest
May 25th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. <?php
  2. // turn what we figured out the user entered into a canonicalized string.
  3. // $parsed is a hash with keys of scheme, user, domain, port, and path.
  4. function normalize_input($parsed) {
  5. $identifier = '';
  6. if ($parsed['scheme'] == 'acct') {
  7. $identifier = 'acct:' . $parsed['user'] . '@' . $parsed['domain'];
  8. } else {
  9. $identifier = $parsed['scheme'] . '://' . $parsed['domain'];
  10. if ($parsed['port']) {
  11. $identifier .= ':' . $parsed['port'];
  12. }
  13.  
  14. $identifier .= $parsed['path'] ? $parsed['path'] : '/';
  15. }
  16.  
  17. return $identifier;
  18. }
Add Comment
Please, Sign In to add comment