Beispiel #1
0
 public function testQueryStringEncoding()
 {
     // Test encoding of utf-8 characters
     $vars = array('☃' => '☀');
     $encoded = '%E2%98%83=%E2%98%80';
     $url = new \Curry_URL();
     $url->add($vars);
     $this->assertEquals($encoded, $url->getQueryString());
     $url = new \Curry_URL('?' . $encoded);
     $this->assertEquals($vars, $url->getVars());
 }
Beispiel #2
0
/**
 * Global helper function for creating URLs.
 * 
 * This is a helper function for the Curry_URL-class. The first parameter
 * specifies the URL, if empty the current url will be used.
 * 
 * The second parameter is an array of query-string variables to be added
 * to the URL. You can specify key=>value pairs, or if you specify a value 'foo'
 * (ie numerical key) the corresponding $_GET['foo'] value will be used.
 *
 * @param string $url	URL path
 * @param array $vars	Additional query-string variables
 * @return Curry_URL
 */
function url($url = "", array $vars = array())
{
    $url = new Curry_URL($url);
    $url->add($vars);
    return $url;
}