$value ) { if ( is_array( $value ) ) { if ( $sub_array == false ) { $toImplode[] = self::urlencode_array( $value, $key, true ); } else { $toImplode[] = self::urlencode_array( $value, $varName . '[' . $key . ']', true ); } } else { if ( $sub_array == true ) { //$toImplode[] = $varName.'['.$key.']='.urlencode($value); $toImplode[] = $varName . '[' . $key . ']=' . $value; } else { //$toImplode[] = $key.'='.urlencode($value); $toImplode[] = $key . '=' . $value; } } } return implode( $separator, $toImplode ); } /** * @param $script * @param null $array * @return bool */ static function setURL( $script, $array = null ) { //Debug::Arr(self::$data, 'Before: ', __FILE__, __LINE__, __METHOD__, 10); if ( is_array( $array ) && count( $array ) > 0 ) { self::$data = array_merge( self::$data, $array ); } //Debug::Arr(self::$data, 'After: ', __FILE__, __LINE__, __METHOD__, 10); self::$script = $script; return true; } /** * @param null $array * @param null $script * @param bool $merge * @return null|string */ static function getURL( $array = null, $script = null, $merge = true ) { //Debug::Arr($array, 'Passed Array', __FILE__, __LINE__, __METHOD__, 10); //Debug::Arr(self::$data, 'bSelf Data: ', __FILE__, __LINE__, __METHOD__, 10); //Debug::Arr($array, 'bArray: ', __FILE__, __LINE__, __METHOD__, 10); if ( is_array( $array ) && count( $array ) > 0 && $merge == true ) { $array = array_merge( self::$data, $array ); } else if ( $array == null && $merge == true ) { $array = self::$data; } //else Use $array as is. //Debug::Arr($array, 'bAfter: ', __FILE__, __LINE__, __METHOD__, 10); if ( $script == null ) { //$script = Environment::getBaseURL().self::$script; $script = self::$script; } //Debug::Arr($array, 'Final Array', __FILE__, __LINE__, __METHOD__, 10); if ( is_array( $array ) && count( $array ) > 0 ) { $url_values = self::urlencode_array( $array ); //Debug::Text('URL Values: '. $url_values, __FILE__, __LINE__, __METHOD__, 10); //if (isset($url_values) AND is_array($url_values)) { if ( isset( $url_values ) && $url_values != '' ) { $url = '?' . $url_values; } else { $url = '?'; } } if ( isset( $url ) ) { $retval = $script . $url; } else { $retval = $script; } //Debug::Text('URL: '. $retval, __FILE__, __LINE__, __METHOD__, 11); return $retval; } } ?>