public function alter_searchInputTemplate(org_tubepress_api_template_Template $template) { $ioc = org_tubepress_impl_ioc_IocContainer::getInstance(); $context = $ioc->get('org_tubepress_api_exec_ExecutionContext'); $qss = $ioc->get('org_tubepress_api_querystring_QueryStringService'); $ms = $ioc->get('org_tubepress_api_message_MessageService'); $resultsUrl = $context->get(org_tubepress_api_const_options_names_Output::SEARCH_RESULTS_URL); /* if the user didn't request a certain page, just send the search results right back here */ if ($resultsUrl == '') { $resultsUrl = $qss->getFullUrl($_SERVER); } /* clean up the search terms a bit */ $searchTerms = urldecode($qss->getSearchTerms($_GET)); $searchTerms = org_tubepress_impl_util_StringUtils::cleanForSearch($searchTerms); /* * read http://stackoverflow.com/questions/1116019/submitting-a-get-form-with-query-string-params-and-hidden-params-disappear * if you're curious as to what's going on here */ $url = new org_tubepress_api_url_Url($resultsUrl); $params = $url->getQueryVariables(); unset($params[org_tubepress_api_const_querystring_QueryParamName::PAGE]); unset($params[org_tubepress_api_const_querystring_QueryParamName::SEARCH_TERMS]); /* apply the template variables */ $template->setVariable(org_tubepress_api_const_template_Variable::SEARCH_HANDLER_URL, $resultsUrl); $template->setVariable(org_tubepress_api_const_template_Variable::SEARCH_HIDDEN_INPUTS, $params); $template->setVariable(org_tubepress_api_const_template_Variable::SEARCH_TERMS, $searchTerms); $template->setVariable(org_tubepress_api_const_template_Variable::SEARCH_BUTTON, $ms->_('search-input-button')); return $template; }
public function alter_searchInputTemplate(org_tubepress_api_template_Template $template) { $ioc = org_tubepress_impl_ioc_IocContainer::getInstance(); $context = $ioc->get(org_tubepress_api_exec_ExecutionContext::_); $qss = $ioc->get(org_tubepress_api_querystring_QueryStringService::_); $hrps = $ioc->get(org_tubepress_api_http_HttpRequestParameterService::_); $ms = $ioc->get(org_tubepress_api_message_MessageService::_); $resultsUrl = $context->get(org_tubepress_api_const_options_names_InteractiveSearch::SEARCH_RESULTS_URL); $url = ''; try { $url = new org_tubepress_api_url_Url($resultsUrl); } catch (Exception $e) { org_tubepress_impl_log_Log::log('Search Input Core Filter', $e->getMessage()); } /* if the user didn't request a certain page, just send the search results right back here */ if ($url == '') { $url = new org_tubepress_api_url_Url($qss->getFullUrl($_SERVER)); } /* clean up the search terms a bit */ $searchTerms = $hrps->getParamValue(org_tubepress_api_const_http_ParamName::SEARCH_TERMS); $searchTerms = urldecode($searchTerms); //TODO: get rid of this once we move to POST? /* * read http://stackoverflow.com/questions/1116019/submitting-a-get-form-with-query-string-params-and-hidden-params-disappear * if you're curious as to what's going on here */ $params = $url->getQueryVariables(); unset($params[org_tubepress_api_const_http_ParamName::PAGE]); unset($params[org_tubepress_api_const_http_ParamName::SEARCH_TERMS]); /* apply the template variables */ $template->setVariable(org_tubepress_api_const_template_Variable::SEARCH_HANDLER_URL, $url->toString()); $template->setVariable(org_tubepress_api_const_template_Variable::SEARCH_HIDDEN_INPUTS, $params); $template->setVariable(org_tubepress_api_const_template_Variable::SEARCH_TERMS, $searchTerms); $template->setVariable(org_tubepress_api_const_template_Variable::SEARCH_BUTTON, $ms->_('Search')); //>(translatable)< return $template; }