]> dev.renevier.net Git - syj.git/blobdiff - application/views/helpers/UriPath.php
store lang preference in session instead of url
[syj.git] / application / views / helpers / UriPath.php
diff --git a/application/views/helpers/UriPath.php b/application/views/helpers/UriPath.php
new file mode 100644 (file)
index 0000000..8d267d5
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+/*  This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
+    and is published under the AGPL license. */
+
+class Syj_View_Helper_UriPath extends Zend_View_Helper_Abstract
+{
+    public function uriPath($encoded = false) {
+        $uri = Zend_Controller_Front::getInstance()->getRequest()->getRequestUri();
+        if (($pos = strpos($uri, '?')) !== false) {
+            $uri = substr($uri, 0, $pos);
+        }
+        if ($encoded) {
+            $uri = implode('/', array_map('urlencode', explode('/', $uri)));
+        }
+        return $uri;
+    }
+}