Skip to content
Snippets Groups Projects
Commit 817677c5 authored by llaffont's avatar llaffont
Browse files

URL_REWRITING: le helper absoluteUrl n'ajoute pas le sous dossier

parent cd03b229
Branches
Tags
No related merge requests found
......@@ -19,6 +19,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class ZendAfi_View_Helper_AbsoluteUrl extends Zend_View_Helper_HtmlElement {
protected static $_do_not_add_base_url;
public static function doNotAddBaseUrl() {
static::$_do_not_add_base_url = true;
}
public function absoluteUrl($url_array_or_string = [], $name = null, $reset = false, $encode = true) {
$url = is_string($url_array_or_string)
? $url_array_or_string
......@@ -27,7 +33,7 @@ class ZendAfi_View_Helper_AbsoluteUrl extends Zend_View_Helper_HtmlElement {
if (preg_match('/http[s]?:\/\//', $url))
return $url;
if (0 !== strpos($url, BASE_URL))
if ((!static::$_do_not_add_base_url) && (0 !== strpos($url, BASE_URL)))
$url = BASE_URL . $url;
return 'http://' . $_SERVER['SERVER_NAME'] . $url;
......
......@@ -309,6 +309,8 @@ function setupRoutes($front_controller, $cfg) {
$front_controller
->setBaseUrl('')
->setRouter(new ZendAfi_Controller_Router_RewriteWithoutBaseUrl());
ZendAfi_View_Helper_AbsoluteUrl::doNotAddBaseUrl();
}
$front_controller
......
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