Last active
December 16, 2015 03:49
-
-
Save putzflorian/5372377 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Website_Controller_Action extends Pimcore_Controller_Action_Frontend { | |
| public function init () { | |
| if($this->_getParam("language") && Zend_Locale::isLocale($this->_getParam("language"))) { | |
| $locale = new Zend_Locale($this->_getParam("language")); | |
| Zend_Registry::set("Zend_Locale", $locale); | |
| } | |
| parent::init(); | |
| $this->view->addHelperPath(PIMCORE_WEBSITE_PATH . "/lib/Website/View/Helper", "Website_View_Helper_"); | |
| if(Zend_Registry::isRegistered("Zend_Locale")) { | |
| $locale = Zend_Registry::get("Zend_Locale"); | |
| } else { | |
| $locale = new Zend_Locale("en"); | |
| Zend_Registry::set("Zend_Locale", $locale); | |
| } | |
| $this->view->language = $locale->getLanguage(); | |
| $this->language = $locale->getLanguage(); | |
| // document path | |
| $document_path = $this->_request->getPathInfo(); | |
| if (substr($document_path,-1) == "/") { | |
| $this->view->document_path = $this->_request->getPathInfo(); | |
| $this->document_path = $this->_request->getPathInfo(); | |
| } | |
| else { | |
| $this->view->document_path = $this->_request->getPathInfo(); | |
| $this->document_path = $this->_request->getPathInfo(); | |
| } | |
| $cfg = Zend_Registry::get("pimcore_config_system"); | |
| $this->cfg = $cfg; | |
| $this->view->cfg = $cfg; | |
| } | |
| public function getQueryString() | |
| { | |
| $valid_keys = array( | |
| "q", | |
| "submit", | |
| "saison", | |
| "town" | |
| ); | |
| // create query string | |
| if (is_array($this->_getAllParams()) and count($this->_getAllParams()) > 0) { | |
| foreach ( | |
| $this->_getAllParams() as $key => $value | |
| ) { | |
| if (in_array($key, $valid_keys)) { | |
| if (is_string($value)) { | |
| if (!empty($value)) { | |
| $tmpQ[] = $key . "=" . $value; | |
| } | |
| } else { | |
| if (is_array($value)) { | |
| foreach ( | |
| $value as $v | |
| ) { | |
| $tmpQ[] = $key . "[]=" . $v; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| if (count($tmpQ) > 0) { | |
| return "&" . implode("&", $tmpQ); | |
| } else { | |
| return false; | |
| } | |
| } else { | |
| return false; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment