1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: 19: 20: 21: 22: 23:
24: class cUriBuilderCustom extends cUriBuilder {
25:
26: 27: 28: 29: 30:
31: private static $_instance;
32:
33: 34: 35: 36: 37:
38: private $aConfig;
39:
40: 41: 42:
43: private function __construct() {
44: $this->sHttpBasePath = '';
45: }
46:
47: 48: 49: 50: 51:
52: public static function getInstance() {
53: if (self::$_instance == NULL) {
54: self::$_instance = new self();
55: }
56: return self::$_instance;
57: }
58:
59: 60: 61: 62: 63: 64: 65: 66: 67: 68:
69: public function buildUrl(array $aParams, $bUseAbsolutePath = false, array $aConfig = array()) {
70: if (sizeof($aParams) == 0) {
71: throw new cInvalidArgumentException('$aParams must have at least one entry!');
72: }
73:
74:
75: if (sizeof($aConfig) == 0 || !isset($aConfig['prefix']) || !isset($aConfig['suffix']) || !isset($aConfig['separator'])) {
76: include_once('class.uribuilder.config.php');
77: $aConfig = cUriBuilderConfig::getConfig();
78: }
79: $this->aConfig = $aConfig;
80:
81: $this->sUrl = $bUseAbsolutePath === true ? $this->sHttpBasePath : '';
82: $this->sUrl .= $this->aConfig['prefix'];
83: foreach ($aParams as $sKey => $mVal) {
84: $sVal = $mVal;
85: if (is_array($mVal)) {
86:
87: $sVal = implode($this->aConfig['separator'], $mVal);
88: }
89: $this->sUrl .= $this->aConfig['separator'] . strval($sKey) . $this->aConfig['separator'] . strval($sVal);
90: }
91: $this->sUrl .= $this->aConfig['suffix'];
92: }
93:
94: }
95: