本文整理汇总了PHP中Zend_Controller_Request_Abstract::getRequestUri方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Abstract::getRequestUri方法的具体用法?PHP Zend_Controller_Request_Abstract::getRequestUri怎么用?PHP Zend_Controller_Request_Abstract::getRequestUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Abstract
的用法示例。
在下文中一共展示了Zend_Controller_Request_Abstract::getRequestUri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: routeStartup
public function routeStartup(Zend_Controller_Request_Abstract $request)
{
if (substr($request->getRequestUri(), 0, -1) == $request->getBaseUrl()) {
$request->setRequestUri($request->getRequestUri() . Zend_Registry::get('parameters')->registry->defaultlanguage . "/");
$request->setParam("language", Zend_Registry::get('parameters')->registry->defaultlanguage);
}
}
示例2: routeShutdown
/**
* Locate path alias node
* @see library/Zend/Controller/Plugin/Zend_Controller_Plugin_Abstract#routeStartup($request)
*
* @param Zend_Controller_Request_Abstract $request
* @return void
*/
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
if ($request->getRequestUri() != "/" && ($path = Zoo::getService('path')->findPath($request->getRequestUri()))) {
$content_service = Zoo::getService('content');
$request->setActionName($content_service->action);
$request->setControllerName($content_service->controller);
$request->setModuleName($content_service->module);
$request->setParam('id', $path->nid);
}
}
示例3: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
// home page must be excluded from log
if (strtolower($request->getRequestUri()) === strtolower($this->_request->getBaseUrl() . '/')) {
return;
}
if ($this->_isIncludedInLog($request->getRequestUri())) {
// add metric
$this->_addMetric($request->getRequestUri());
}
}
示例4: routeShutdown
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
if ($this->getRequest()->getModuleName() == 'admin') {
return;
}
$uri = $request->getRequestUri();
if (!($titles = Z_Cache::getInstance()->load('z_titles'))) {
$table_titles = new Z_Model_Titles();
$titles = $table_titles->fetchAll(NULL, 'orderid asc');
Z_Cache::getInstance()->save($titles, 'z_titles');
}
foreach ($titles as $title) {
if (strpos($uri, $title->uri) === 0) {
if ($title->title_block) {
Z_Seo::addTitle($title->title);
} else {
Z_Seo::setTitle($title->title);
}
if ($title->description_block) {
Z_Seo::addDescription($title->description);
} else {
Z_Seo::setDescription($title->description);
}
if ($title->keywords_block) {
Z_Seo::addKeywords($title->keywords);
} else {
Z_Seo::setKeywords($title->keywords);
}
}
}
}
示例5: postDispatch
public function postDispatch(Zend_Controller_Request_Abstract $request)
{
// if (Zend_Registry::isRegistered(Tomato_Core_GlobalKey::LOG_REQUEST)
// && Zend_Registry::get(Tomato_Core_GlobalKey::LOG_REQUEST) == false
// ) {
// return;
// }
$objRequestLog = new Model_RequestLog();
$uri = $request->getRequestUri();
$agent = $request->getServer('HTTP_USER_AGENT');
$browserInfo = self::_getBrowserInfo($agent);
$objRequestLog->insert(array('ip' => $request->getClientIp(), 'agent' => $agent, 'browser' => $browserInfo['browser'], 'version' => $browserInfo['version'], 'platform' => $browserInfo['platform'], 'bot' => self::_getBot($agent), 'uri' => $uri, 'full_url' => $request->getScheme() . '://' . $request->getHttpHost() . '/' . ltrim($uri, '/'), 'refer_url' => $request->getServer('HTTP_REFERER'), 'access_time' => date('Y-m-d H:i:s')));
// $log = new Tomato_Modules_Core_Model_RequestLog(
// array(
// 'ip' => $request->getClientIp(),
// 'agent' => $agent,
// 'browser' => $browserInfo['browser'],
// 'version' => $browserInfo['version'],
// 'platform' => $browserInfo['platform'],
// 'bot' => self::_getBot($agent),
// 'uri' => $uri,
// 'full_url' => $request->getScheme().'://'.$request->getHttpHost().'/'.ltrim($uri, '/'),
// 'refer_url' => $request->getServer('HTTP_REFERER'),
// 'access_time' => date('Y-m-d H:i:s'),
// )
// );
// $conn = Tomato_Core_Db_Connection::getMasterConnection();
// $gateway = new Tomato_Modules_Core_Model_RequestLogGateway();
// $gateway->setDbConnection($conn);
// $gateway->create($log);
}
示例6: postDispatch
/**
* @todo: This has nothing to do with the langselector, so maybe move it to its own plugin
*
*/
public function postDispatch(Zend_Controller_Request_Abstract $request)
{
// Don't save ajax call url's as the last request
if (!$request->isXmlHttpRequest()) {
$lastRequest = Zend_Controller_Action_HelperBroker::getStaticHelper('lastRequest');
$lastRequest->saveRequestUri($request->getRequestUri());
}
}
示例7: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
try {
Zwe_Model_Page::getThisPage($request->getRequestUri());
} catch (Exception $E) {
# Do nothing
}
}
示例8: routeShutdown
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
$navContainer = null;
$viewRenderer = Zend_Controller_Action_HelperBroker::getExistingHelper('ViewRenderer');
$viewRenderer->initView();
$view = $viewRenderer->view;
$module = $request->getModuleName();
if ($module == "admin") {
$navContainerConfig = new Zend_Config_Xml(APPLICATION_PATH . '/modules/admin/navigation.xml', 'nav');
$navContainer = new Zend_Navigation($navContainerConfig);
// Load the xml navigation menu
// check if the database configuration has been set
if (Shineisp_Main::isReady()) {
// Adding the configuration menu items
$configuration = SettingsGroups::getlist();
$submenu = $navContainer->findOneByLabel('Configuration');
foreach ($configuration as $id => $item) {
$pages[] = array('label' => $item, 'uri' => '/admin/settings/index/groupid/' . $id, 'resource' => 'admin:settings');
}
$submenu->addPages($pages);
}
// Attach the Zend ACL to the Navigation menu
$auth = Zend_Auth::getInstance();
if ($auth) {
$acl = $auth->getStorage()->read();
if (is_object($acl)) {
Zend_View_Helper_Navigation_HelperAbstract::setDefaultAcl($acl);
Zend_View_Helper_Navigation_HelperAbstract::setDefaultRole("administrator");
}
}
} elseif ($module == "default") {
$navContainerConfig = new Zend_Config_Xml(APPLICATION_PATH . '/modules/default/navigation.xml', 'nav');
$navContainer = new Zend_Navigation($navContainerConfig);
// Load the xml navigation menu
// Attach the Zend ACL to the Navigation menu
$auth = Zend_Auth::getInstance();
if ($auth) {
$acl = $auth->getStorage()->read();
if (is_object($acl)) {
Zend_View_Helper_Navigation_HelperAbstract::setDefaultAcl($acl);
Zend_View_Helper_Navigation_HelperAbstract::setDefaultRole("guest");
}
}
}
if ($navContainer) {
foreach ($navContainer->getPages() as $page) {
foreach ($page->getPages() as $subpage) {
foreach ($subpage->getPages() as $subsubpage) {
$uri = $subsubpage->getHref();
if ($uri === $request->getRequestUri()) {
$subsubpage->setActive(true);
}
}
}
}
$view->navigation($navContainer);
}
}
示例9: preDispatch
/**
* Predispatch
*
* @param Zend_Controller_Request_Abstract $request
*/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
// Check if user is authenticated
// [...]
// Store url before redirecting user to login page
$flashRedirector = Zend_Controller_Action_HelperBroker::getStaticHelper('FlashRedirector');
$flashRedirector->setRedirect($request->getRequestUri());
// Redirect to login page
// [...]
}
示例10: isNotToRemember
protected function isNotToRemember(Zend_Controller_Request_Abstract $request)
{
if (in_array($request->getControllerName(), $this->_ignoreList)) {
return true;
}
if ($request->getRequestUri() == '/favicon.ico') {
return true;
}
return false;
}
示例11: preDispatch
/**
* This plugin validates sessions on pages that require
*
* @param Zend_Controller_Request_Abstract $request
*/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
if (!$this->_isPublicPage($request->getRequestUri())) {
// if user has not identity, must login first
if (!Zend_Auth::getInstance()->hasIdentity()) {
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$redirector->gotoUrl('/portal/index/login/');
}
}
}
示例12: routeStartup
public function routeStartup(Zend_Controller_Request_Abstract $request)
{
$robotsPath = PIMCORE_CONFIGURATION_DIRECTORY . "/robots.txt";
if ($request->getRequestUri() == "/robots.txt") {
if (is_file($robotsPath)) {
header("Content-Type: text/plain; charset=utf8");
echo file_get_contents($robotsPath);
exit;
}
}
}
示例13: _routeNoAuth
/**
* @access protected
* @return void
*/
protected function _routeNoAuth()
{
$this->_auth->clearIdentity();
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
if (!$this->_request->isXMLHttpRequest()) {
$this->_session->triedroute = str_replace($baseUrl, '', $this->_request->getRequestUri());
} else {
$helperBroker = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
$helperBroker->direct(array('error' => true, 'status' => false, 'logout' => true));
}
$this->_setRouter($this->_noAuth);
}
示例14: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$acl = Zend_Registry::get('acl');
$auth = Zend_Auth::getInstance();
// get user role
$role = $auth->hasIdentity() ? $auth->getIdentity() : 'guest';
// whitelist web module
if ($request->getModuleName() == 'web') {
return;
}
if ($role != 'guest') {
// prevent redirect loop by excluding 'user' controller actions
if ($auth->getIdentity()->email == 'invalid_email_needs_updating' && $request->getControllerName() != 'user') {
$flash = Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger');
$lastRequest = Zend_Controller_Action_HelperBroker::getStaticHelper('lastRequest');
$redir = Zend_Controller_Action_HelperBroker::getStaticHelper('Redirector');
$flash->addMessage('Your IdP did not provide a valid email address, please supply one below.');
$lastRequest->saveRequestUri($request->getRequestUri());
$redir->setCode(303)->setExit(true)->gotoRoute(array('controller' => 'user', 'action' => 'edit', 'id' => $auth->getIdentity()->user_id), 'main-module');
}
}
// check if ACL resource exists
if (!$acl->has(ucfirst($request->getControllerName()))) {
return;
}
// check if user is allowed to access resource
if (!$acl->isAllowed($role, ucfirst($request->getControllerName()), $request->getActionName())) {
// allow all calls to the rest module
if ($request->getModuleName() == 'rest') {
return;
}
$lastRequest = Zend_Controller_Action_HelperBroker::getStaticHelper('lastRequest');
$redir = Zend_Controller_Action_HelperBroker::getStaticHelper('Redirector');
// save last request in session since this data will be lost after redirect
// have to call it here because the request URI is saved in postDispatch()
$lastRequest->saveRequestUri($request->getRequestUri());
// perform redirect
$redir->setCode(303)->setExit(true)->gotoRoute(array('controller' => 'error', 'action' => 'noaccess', 'resource' => $acl->get(ucfirst($request->getControllerName()))->getResourceId(), 'privilege' => $request->getActionName()), 'main-module');
}
}
示例15: routeShutdown
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
$viewRenderer = Zend_Controller_Action_HelperBroker::getExistingHelper('ViewRenderer');
$viewRenderer->initView();
$view = $viewRenderer->view;
$container = new Zend_Navigation(Zend_Registry::get('configuration')->navigation);
foreach ($container->getPages() as $page) {
$uri = $page->getHref();
if ($uri === $request->getRequestUri()) {
$page->setClass('active');
}
}
$view->navigation($container);
}