Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // turn what we figured out the user entered into a canonicalized string.
- // $parsed is a hash with keys of scheme, user, domain, port, and path.
- function normalize_input($parsed) {
- $identifier = '';
- if ($parsed['scheme'] == 'acct') {
- $identifier = 'acct:' . $parsed['user'] . '@' . $parsed['domain'];
- } else {
- $identifier = $parsed['scheme'] . '://' . $parsed['domain'];
- if ($parsed['port']) {
- $identifier .= ':' . $parsed['port'];
- }
- $identifier .= $parsed['path'] ? $parsed['path'] : '/';
- }
- return $identifier;
- }
Add Comment
Please, Sign In to add comment