function __construct($id, $method = 'post', $attributes = null, $trackSubmit = false) { if (!isset($attributes['action'])) { $attributes['action'] = Url::getCurrentQueryString(); } if (!isset($attributes['name'])) { $attributes['name'] = $id; } parent::__construct($id, $method, $attributes, $trackSubmit); $this->init(); }
/** * @group Core */ public function testAllMethods() { $this->assertEquals(Url::getCurrentQueryStringWithParametersModified(array()), Url::getCurrentQueryString()); $this->assertEquals(Url::getCurrentUrl(), Url::getCurrentUrlWithoutQueryString()); $this->assertEquals(Url::getCurrentUrl(), Url::getCurrentScheme() . '://' . Url::getCurrentHost() . Url::getCurrentScriptName()); $_SERVER['QUERY_STRING'] = 'q=test'; $parameters = array_keys(Url::getArrayFromCurrentQueryString()); $parametersNameToValue = array(); foreach ($parameters as $name) { $parametersNameToValue[$name] = null; } $this->assertEquals('', Url::getCurrentQueryStringWithParametersModified($parametersNameToValue)); }
/** * Check force_ssl_login and redirect if connection isn't secure and not using a reverse proxy * * @param none * @return void */ protected function checkForceSslLogin() { $forceSslLogin = Config::getInstance()->General['force_ssl_login']; if ($forceSslLogin && !ProxyHttp::isHttps()) { $url = 'https://' . Url::getCurrentHost() . Url::getCurrentScriptName() . Url::getCurrentQueryString(); Url::redirectToUrl($url); } }