| version 1.1, 2002/04/20 23:03:15 |
version 1.2, 2002/04/21 23:23:43 |
|
|
| <?php |
<?php |
| |
|
| /* |
/* |
| * glue_url() |
* phpPlatonLib - Platon software development group PHP library |
| * |
|
| * Creates URL string from components. |
|
| * $url - the result array from the parse_url() |
|
| * |
* |
| |
* common/url/fnc.glue_url.php - create URL string from components; |
| |
* components are array as it is returned from glue_url() function |
| * Author: Tomas V.V.Cox <cox@idecnet.com> [19-Feb-2001] |
* Author: Tomas V.V.Cox <cox@idecnet.com> [19-Feb-2001] |
| |
* ____________________________________________________________ |
| |
* |
| |
* Developed by Ondrej Jombik <nepto@pobox.sk> |
| |
* Copyright (c) 2001-2002 Platon SDG, http://www.platon.sk/ |
| |
* All rights reserved. |
| |
* |
| |
* See README file for more information about this software. |
| |
* See COPYING file for license information. |
| |
* |
| |
* Download the latest version from |
| |
* http://www.platon.sk/projects/phpPlatonLib/ |
| */ |
*/ |
| |
|
| function glue_url($url) |
/* $Id$ */ |
| { |
|
| if (! is_array($url)) |
if (! defined('phpPlatonLib_fnc_glue_url')) { |
| return false; |
define('phpPlatonLib_fnc_glue_url', 1); |
| |
|
| // scheme |
function glue_url($url) |
| $uri = empty($url['scheme']) ? '' : $url['scheme'] . '://'; |
{ |
| |
if (! is_array($url)) |
| // user and pass |
return false; |
| if (! empty($url['user'])) { |
|
| $uri .= $url['user'].':'.$url['pass'].'@'; |
// scheme |
| } |
$uri = empty($url['scheme']) ? '' : $url['scheme'] . '://'; |
| |
|
| // host |
// user and pass |
| $uri .= $url['host']; |
if (! empty($url['user'])) { |
| |
$uri .= $url['user'].':'.$url['pass'].'@'; |
| // port |
} |
| $port = empty($url['port']) ? '' : ':'.$url['port']; |
|
| $uri .= $port; |
// host |
| |
$uri .= $url['host']; |
| // path |
|
| $uri .= $url['path']; |
// port |
| |
$port = empty($url['port']) ? '' : ':'.$url['port']; |
| // fragment or query |
$uri .= $port; |
| if (isset($url['fragment'])) { |
|
| $uri .= '#' . $url['fragment']; |
// path |
| } |
$uri .= $url['path']; |
| elseif (isset($url['query'])) { |
|
| $uri .= '?' . $url['query']; |
// fragment or query |
| } |
if (isset($url['fragment'])) { |
| |
$uri .= '#' . $url['fragment']; |
| |
} |
| |
elseif (isset($url['query'])) { |
| |
$uri .= '?' . $url['query']; |
| |
} |
| |
|
| |
return $uri; |
| |
} |
| |
|
| return $uri; |
|
| } |
} |
| |
|
| ?> |
?> |