本文整理汇总了PHP中Zend_Controller_Request_Http类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Http类的具体用法?PHP Zend_Controller_Request_Http怎么用?PHP Zend_Controller_Request_Http使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Controller_Request_Http类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: match
/**
* Validate and Match Cms Page and modify request
*
* @param Zend_Controller_Request_Http $request
* @return bool
*
* @SuppressWarnings(PHPMD.ExitExpression)
*/
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$identifier = trim($request->getPathInfo(), '/');
$condition = new Varien_Object(array('identifier' => $identifier, 'continue' => true));
Mage::dispatchEvent('cms_controller_router_match_before', array('router' => $this, 'condition' => $condition));
$identifier = $condition->getIdentifier();
if ($condition->getRedirectUrl()) {
Mage::app()->getFrontController()->getResponse()->setRedirect($condition->getRedirectUrl())->sendResponse();
$request->setDispatched(true);
return Mage::getControllerInstance('Mage_Core_Controller_Varien_Action_Forward', $request, Mage::app()->getFrontController()->getResponse());
}
if (!$condition->getContinue()) {
return null;
}
$page = Mage::getModel('Mage_Cms_Model_Page');
$pageId = $page->checkIdentifier($identifier, Mage::app()->getStore()->getId());
if (!$pageId) {
return null;
}
$request->setModuleName('cms')->setControllerName('page')->setActionName('view')->setParam('page_id', $pageId);
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
return Mage::getControllerInstance('Mage_Core_Controller_Varien_Action_Forward', $request, Mage::app()->getFrontController()->getResponse());
}
示例2: match
/**
* Match a specific route for an already matched prefix.
*
* @see XenForo_Route_Interface::match()
*/
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$components = explode('/', $routePath);
$action = strtolower(array_shift($components));
if (count($components) == 1) {
// permission/<action>, etc
$action .= reset($components);
} else {
switch ($action) {
case 'permission':
// permission/<group>/<permission>/<action>
$request->setParam('permission_group_id', array_shift($components));
$request->setParam('permission_id', array_shift($components));
break;
case 'permission-group':
// permission-group/<group>/<action>
$request->setParam('permission_group_id', array_shift($components));
break;
case 'interface-group':
// interface-group/<group>/<action>
$request->setParam('interface_group_id', array_shift($components));
break;
}
$action .= implode('', $components);
}
return $router->getRouteMatch('XenForo_ControllerAdmin_Permission', $action, 'permissionsDevelopment');
}
示例3: match
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$identifier = trim($request->getPathInfo(), '/');
$condition = new Varien_Object(array('identifier' => $identifier, 'continue' => true));
Mage::dispatchEvent('magicproduct_controller_router_match_before', array('router' => $this, 'condition' => $condition));
$identifier = $condition->getIdentifier();
if ($condition->getRedirectUrl()) {
Mage::app()->getFrontController()->getResponse()->setRedirect($condition->getRedirectUrl())->sendResponse();
$request->setDispatched(true);
return true;
}
if (!$condition->getContinue()) {
return false;
}
if (!in_array($identifier, $this->router)) {
return false;
}
$request->setModuleName('magicproduct')->setControllerName('index')->setActionName('product')->setParam('type', $identifier);
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
return true;
}
示例4: geraTagXml
private static function geraTagXml($type)
{
$request = new \Zend_Controller_Request_Http();
$arrRequest = explode('/', $request->getRequestUri());
if (!empty($arrRequest[3])) {
$rota = (string) $arrRequest[1] . '/' . $arrRequest[2] . '/' . $arrRequest[3];
} else {
$rota = (string) $arrRequest[1] . '/' . $arrRequest[2];
}
$xml = "<schema>";
$xml .= "<nome>corporativo</nome>";
$xml .= "<rota>{$rota}</rota>";
$xml .= "<tabela>";
foreach ($type as $key => $value) {
$nomeTabela = self::converteString($key);
$xml .= "<nome>" . $nomeTabela . "</nome>";
foreach ($value as $k => $v) {
if (!is_array($v) && !is_object($v)) {
$xml .= "<coluna>";
$palavraConvertida = self::converteString($k);
$v = self::procuraData($palavraConvertida) ? self::converteData($v) : $v;
$xml .= "<nome>" . $palavraConvertida . "</nome>";
$xml .= "<valor>" . $v . "</valor>";
$xml .= "</coluna>";
}
}
}
$xml .= "</tabela>";
$xml .= "</schema>";
return $xml;
}
示例5: match
public function match(Zend_Controller_Request_Http $request)
{
//default route (404)
$d = explode('/', Mage::getStoreConfig('web/default/no_route'));
$request->setModuleName(isset($d[0]) ? $d[0] : 'core')->setControllerName(isset($d[1]) ? $d[1] : 'index')->setActionName(isset($d[2]) ? $d[2] : 'index');
return true;
}
示例6: match
/**
* Validate and Match Cms Page and modify request
*
* @param Zend_Controller_Request_Http $request
* @return bool
*/
public function match(Zend_Controller_Request_Http $request)
{
if (Mage::app()->getStore()->isAdmin()) {
return false;
}
$pathInfo = $request->getPathInfo();
// remove suffix if any
$suffix = Mage::helper('amlanding/url')->getSuffix();
if ($suffix && '/' != $suffix) {
$pathInfo = str_replace($suffix, '', $pathInfo);
}
$pathInfo = explode('/', trim($pathInfo, '/ '), 2);
$identifier = $pathInfo[0];
$params = isset($pathInfo[1]) ? $pathInfo[1] : '';
/* @var $page Amasty_Xlanding_Model_Page */
$page = Mage::getModel('amlanding/page');
$pageId = $page->checkIdentifier($identifier, Mage::app()->getStore()->getId());
if (!$pageId) {
return false;
}
$params = trim($params, '/ ');
if ($params) {
$params = explode('/', $params);
Mage::register('amshopby_current_params', $params);
}
$request->setModuleName('amlanding')->setControllerName('page')->setActionName('view')->setParam('page_id', $pageId)->setParam('am_landing', $identifier);
return true;
}
示例7: preDispatch
/**
* Called before an action is dispatched by Zend_Controller_Dispatcher.
*
* This callback allows for proxy or filter behavior. The
* $action must be returned for the Zend_Controller_Dispatcher_Token to be dispatched.
* To abort the dispatch, return FALSE.
*
* @param Zend_Controller_Request_Http $action
* @return Zend_Controller_Dispatcher_Token|boolean
*/
public function preDispatch($action)
{
$module = $action->getModuleName();
$definition = null;
if (isset($this->config[$module])) {
$definition = $this->config[$module];
} else {
if (isset($this->config['master_layout'])) {
$definition = $this->config['master_layout'];
}
}
if ($definition != null && !$action->getParam('__ignorelayout')) {
$view = null;
$layoutName = $this->getViewNameFrom($definition, strtolower($action->getControllerName()), strtolower($action->getActionName()));
if ($layoutName) {
$view = new MasterView($layoutName, $this->config['layout_path']);
}
if ($view != null) {
Zend_Registry::set('MasterView', $view);
$baseView = Zend_Registry::get(NovemberApplication::$ZEND_VIEW);
$baseView->setMaster('MasterView');
}
}
return $action;
}
示例8: _addHomepageRoute
/**
* Adds the homepage route to the router (as specified by the navigation settings page)
* The route will not be added if the user is currently on the admin theme.
*
* @param Zend_Controller_Router_Rewrite $router The router
*/
private function _addHomepageRoute($router)
{
// Don't add the route if the user is on the admin theme
if (is_admin_theme()) {
return;
}
$homepageUri = trim(get_option(Omeka_Form_Navigation::HOMEPAGE_URI_OPTION_NAME));
if (strpos($homepageUri, ADMIN_BASE_URL) === 0) {
// homepage uri is an admin link
$this->_addHomepageRedirect($homepageUri, $router);
} else {
if (strpos($homepageUri, '?') === false) {
// left trim root directory off of the homepage uri
$relativeUri = $this->_leftTrim($homepageUri, PUBLIC_BASE_URL);
// make sure the new homepage is not the default homepage
if ($relativeUri == '' || $relativeUri == '/') {
return;
}
$homepageRequest = new Zend_Controller_Request_Http();
$homepageRequest->setRequestUri($homepageUri);
$router->route($homepageRequest);
$dispatcher = Zend_Controller_Front::getInstance()->getDispatcher();
if ($dispatcher->isDispatchable($homepageRequest)) {
// homepage is an internal link
$router->addRoute(self::HOMEPAGE_ROUTE_NAME, new Zend_Controller_Router_Route('/', $homepageRequest->getParams()));
return;
}
}
}
// homepage is some external link, a broken internal link, or has a
// query string
$this->_addHomepageRedirect($homepageUri, $router);
}
示例9: match
/**
* match the route
* @param Zend_Controller_Request_Http $request
* @return bool
*/
public function match(Zend_Controller_Request_Http $request)
{
//if magento is not installed redirect to install
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
//get the url key
$urlKey = trim($request->getPathInfo(), '/');
//explode by slash
$parts = explode('/', $urlKey);
//if there are not 2 parts (tag/something) in the url we don't care about it.
//return false and let the rest of the application take care of the url.
if (count($parts) != 2) {
return false;
}
//if the first part of the url key is not 'tag' we don't care about it
//return false and let the rest of the application take care of the url
if ($parts[0] != 'tag') {
return false;
}
$tagName = urldecode($parts[1]);
//tag name
//load the tag model
$tag = Mage::getModel('tag/tag')->loadByName($tagName);
//if there is no tag with this name available in the current store just do nothing
if (!$tag->getId() || !$tag->isAvailableInStore()) {
return false;
}
//but if the tag is valid
//say to magento that the request should be mapped to `tag/product/list/tagId/ID_HERE` - the original url
$request->setModuleName('tag')->setControllerName('product')->setActionName('list')->setParam('tagId', $tag->getId());
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $urlKey);
return true;
}
示例10: myUrl
/**
* Return the URL
*
* @param string|array $urlOptions
* @param string $name
* @param bool $reset
* @param bool $encode
* @return string
*/
public function myUrl($urlOptions = array(), $name = null, $reset = false, $encode = true)
{
$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();
$extraUrlOptions = array();
$extraOptions = Zend_Controller_Front::getInstance()->getRequest()->getParams();
if (count($extraOptions)) {
foreach ($extraOptions as $key => $value) {
if ($key != 'module' && $key != 'controller' && $key != 'action') {
$extraUrlOptions[] = $key . '=' . ($encode ? urlencode($value) : $value);
}
}
}
if (is_string($urlOptions)) {
$urlOptions = '/' . ltrim($urlOptions, '/');
// Case the first character is ?
$request = new Zend_Controller_Request_Http();
// Creates a cleaned instance of request http
示例11: nopageAction
public function nopageAction()
{
$http = new Zend_Controller_Request_Http();
if ($http->isXmlHttpRequest()) {
$this->view->noLayout = true;
}
}
示例12: match
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::app()->isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$pathInfo = trim($request->getPathInfo(), '/');
//echo $pathInfo;die();
$pathInfoAr = explode('/', $pathInfo);
if ($pathInfoAr[0] == Mage::getStoreConfig('vc_miniblog/blog/router')) {
if (isset($pathInfoAr[1])) {
switch ($pathInfoAr[1]) {
case 'tag':
$request->setModuleName('vc_miniblog')->setControllerName('index')->setActionName('index');
$request->setParams(array('tag' => $pathInfoAr[2]));
$request->setParams(array('tag' => $pathInfoAr[2]));
break;
case 'cat':
$request->setModuleName('vc_miniblog')->setControllerName('index')->setActionName('index');
$request->setParams(array('cat' => $pathInfoAr[2]));
break;
default:
$request->setModuleName('vc_miniblog')->setControllerName('index')->setActionName('postDetail');
$request->setParams(array('identifier' => $pathInfoAr[1]));
break;
}
} else {
$request->setModuleName('vc_miniblog')->setControllerName('index')->setActionName('index');
}
return true;
}
return false;
}
示例13: match
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::app()->isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$route = "f";
$identifier = $request->getPathInfo();
if (substr(str_replace("/", "", $identifier), 0, strlen($route)) != $route) {
return false;
}
$identifier = substr_replace($request->getPathInfo(), '', 0, strlen("/" . $route . "/"));
$identifier = str_replace('.html', '', $identifier);
$identifier = str_replace('.htm', '', $identifier);
$identifier = str_replace('.php', '', $identifier);
if ($identifier[strlen($identifier) - 1] == "/") {
$identifier = substr($identifier, '', -1);
}
$identifier = explode('/', $identifier, 3);
if (isset($identifier[1]) && isset($identifier[0]) && !isset($identifier[2])) {
$request->setModuleName('f')->setControllerName('index')->setActionName('view')->setParam('id', $identifier[0])->setParam('v', $identifier[1]);
return true;
} else {
return false;
}
}
示例14: __construct
public function __construct($args = false)
{
if ($args === false) {
// Created with _getProcessor function
$registryKey = '_singleton/amfpc/fpc_front';
Mage::register($registryKey, $this, true);
}
if (isset($_SESSION)) {
$this->_sessionName = session_name();
} else {
$sessionName = (string) Mage::app()->getConfig()->getNode('global/amfpc/session_name');
if ($sessionName) {
$this->_sessionName = $sessionName;
}
}
$request = new Zend_Controller_Request_Http();
$pathInfo = trim(strtok($request->getRequestUri(), '?'), '/');
if ($this->getDbConfig('web/url/use_store')) {
$pathParts = explode('/', $pathInfo);
$storeCode = array_shift($pathParts);
$this->_urlInfo = array('store_code' => $storeCode, 'page' => implode('/', $pathParts));
} else {
$this->_urlInfo = array('store_code' => false, 'page' => $pathInfo);
}
}
示例15: routeShutdown
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
$front = Zend_Controller_Front::getInstance();
// Front controller has error handler plugin
// if the request is an error request.
// If the error handler plugin is not registered,
// we will be unable which MCA to run, so do not continue.
$errorHandlerClass = 'Zend_Controller_Plugin_ErrorHandler';
if (!$front->hasPlugin($errorHandlerClass)) {
return false;
}
// Determine new error controller module_ErrorController_ErrorAction
$plugin = $front->getPlugin($errorHandlerClass);
$errorController = $plugin->getErrorHandlerController();
$errorAaction = $plugin->getErrorHandlerAction();
$module = $request->getModuleName();
// Create test request module_ErrorController_ErrorAction...
$testRequest = new Zend_Controller_Request_Http();
$testRequest->setModuleName($module)->setControllerName($errorController)->setActionName($errorAaction);
// Set new error controller if available
if ($front->getDispatcher()->isDispatchable($testRequest)) {
$plugin->setErrorHandlerModule($module);
} else {
return false;
}
return true;
}