Warning, file /webapps/ocs-webserver/application/modules/default/views/helpers/BuildSearchUrl.php was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 <?php 0002 0003 /** 0004 * ocs-webserver 0005 * 0006 * Copyright 2016 by pling GmbH. 0007 * 0008 * This file is part of ocs-webserver. 0009 * 0010 * This program is free software: you can redistribute it and/or modify 0011 * it under the terms of the GNU Affero General Public License as 0012 * published by the Free Software Foundation, either version 3 of the 0013 * License, or (at your option) any later version. 0014 * 0015 * This program is distributed in the hope that it will be useful, 0016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0018 * GNU Affero General Public License for more details. 0019 * 0020 * You should have received a copy of the GNU Affero General Public License 0021 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0022 **/ 0023 class Default_View_Helper_BuildSearchUrl 0024 { 0025 0026 /** 0027 * @param $searchstring 0028 * @param string $action 0029 * @param array $params 0030 * @param bool $withHost 0031 * @param string $scheme 0032 * 0033 * @return string 0034 */ 0035 public function buildSearchUrl($searchstring, $action = '', $params = null, $withHost = false, $scheme = null) 0036 { 0037 if (empty($searchstring)) { 0038 return ''; 0039 } 0040 0041 /** @var Zend_Controller_Request_Http $request */ 0042 $request = Zend_Controller_Front::getInstance()->getRequest(); 0043 0044 $host = ''; 0045 if ($withHost) { 0046 $http_host = $request->getHttpHost(); 0047 $http_scheme = isset($scheme) ? $scheme : $request->getScheme(); 0048 $host = $http_scheme . '://' . $http_host; 0049 } 0050 0051 $storeId = null; 0052 if (false === isset($params['store_id'])) { 0053 if ($request->getParam('domain_store_id')) { 0054 $storeId = 's/' . $request->getParam('domain_store_id') . '/'; 0055 } 0056 } else { 0057 $storeId = "s/{$params['store_id']}/"; 0058 unset($params['store_id']); 0059 } 0060 0061 return "{$host}/{$storeId}search?{$searchstring}"; 0062 } 0063 0064 }