Skip to content
Snippets Groups Projects
Commit c2a6bea0 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

hotline #61144 : fix RT

parent 11bdf52c
3 merge requests!2334Master,!2184Hotline master,!2182hotline #61144 : add base url prepend in model actions
Pipeline #1668 passed with stage
in 10 minutes and 59 seconds
......@@ -117,6 +117,13 @@ class Class_Url {
}
public static function relative($url_array_or_string, $name=null, $reset=true) {
return is_array($url_array_or_string)
? static::assemble($url_array_or_string, $name, $reset)
: static::prependBaseUrl($url_array_or_string);
}
/**
* Generates an url given the name of a route.
*
......@@ -138,6 +145,14 @@ class Class_Url {
}
public static function prependBaseUrl($url) {
if ((!static::$_do_not_add_base_url) && BASE_URL && (0 !== strpos($url, BASE_URL)))
$url = BASE_URL . ($url[0] == '/' ? $url : '/'.$url);
return ($url[0] == '/' ? $url : '/'.$url);
}
public function absoluteUrl($url_array_or_string = [], $name = null, $reset = false, $encode = true) {
$url = $this->prepare($url_array_or_string, $name, $reset, $encode);
if (preg_match('/http[s]?:\/\//', $url))
......@@ -149,14 +164,6 @@ class Class_Url {
}
public static function prependBaseUrl($url) {
if ((!static::$_do_not_add_base_url) && BASE_URL && (0 !== strpos($url, BASE_URL)))
$url = BASE_URL . ($url[0] == '/' ? $url : '/'.$url);
return ($url[0] == '/' ? $url : '/'.$url);
}
protected function prepare($url_array_or_string, $name, $reset, $encode) {
if (is_string($url_array_or_string))
return $url_array_or_string;
......@@ -170,6 +177,3 @@ class Class_Url {
return static::assemble($url_array_or_string, $name, $reset, $encode);
}
}
?>
\ No newline at end of file
......@@ -151,9 +151,11 @@ class ZendAfi_View_Helper_RenderModelAction {
if(!$url = $this->_conf[self::URL])
return '';
return is_array($url)
? Class_Url::assemble($this->_injectIdIn($id, $url), null, false)
: Class_Url::prependBaseUrl($this->_injectId($id, $url));
$url = is_array($url)
? $this->_injectIdIn($id, $url)
: $this->_injectId($id, $url);
return Class_Url::relative($url, null, false);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment