/** * static CCUrl initialisation */ public static function _init() { static::$path_offset = ClanCats::$config->get('url.path', '/'); if (empty(static::$path_offset)) { static::$path_offset = '/'; } if (substr(static::$path_offset, -1) != '/') { static::$path_offset .= '/'; } // register the default parameter providers static::$parameter_provider = array('fingerprint' => function () { return array(ClanCats::$config->get('session.default_fingerprint_parameter') => fingerprint()); }, 'back' => function () { $params = CCIn::$_instance->GET; unset($params['next']); return array('next' => CCUrl::current($params)); }); }
/** * CCUrl::current */ public function test_current() { // fake some data CCIn::instance(new CCIn_Instance(array('param' => 1, 'test' => 'tee'), array(), array(), array(), array('REQUEST_URI' => '//foo/bar//file.xml?param=1&test=tee'))); $this->assertEquals('/foo/bar/file.xml', CCUrl::current()); $this->assertEquals('/foo/bar/file.xml?param=1&test=tee', CCUrl::current(array(), true)); $this->assertEquals('/foo/bar/file.xml?param=2&test=tee', CCUrl::current(array('param' => 2), true)); $this->assertEquals('/foo/bar/file.xml?param=2', CCUrl::current(array('param' => 2), false)); }