• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Zend_Controller_Request_Abstract类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Zend_Controller_Request_Abstract的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Abstract类的具体用法?PHP Zend_Controller_Request_Abstract怎么用?PHP Zend_Controller_Request_Abstract使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Zend_Controller_Request_Abstract类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: _checkSkipAcl

 protected function _checkSkipAcl(Zend_Controller_Request_Abstract $request, $type)
 {
     // verificação de requisicao - Caso ajax, verifica se a action é delete, senao, SKIP nele.
     if ($request->isXmlHttpRequest() && !in_array($request->getActionName(), $this->_arrAjaxNotSkip)) {
         return TRUE;
     }
     $configs = Zend_Registry::get('configs');
     $skip = $configs['security']['skip'][$type];
     $result = FALSE;
     $result = in_array($request->getActionName(), $skip);
     foreach ($skip as $routers) {
         $route = explode('/', $routers);
         switch (count($route)) {
             case 1:
                 // action
                 $result = in_array($request->getActionName(), $skip);
                 break;
             case 2:
                 // controller/action
                 $result = in_array($request->getControllerName() . '/' . $request->getActionName(), $skip);
                 break;
             case 3:
                 // module/controller/action
                 $result = in_array($request->getModuleName() . '/' . $request->getControllerName() . '/' . $request->getActionName(), $skip);
                 break;
         }
         if ($result) {
             return TRUE;
         }
     }
     return $result;
 }
开发者ID:sgdoc,项目名称:sgdoce-codigo,代码行数:32,代码来源:Security.php


示例2: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $loginController = 'authentication';
     $loginAction = 'login';
     $auth = Zend_Auth::getInstance();
     // If user is not logged in and is not requesting login page
     // - redirect to login page.
     if (!$auth->hasIdentity() && $request->getControllerName() != $loginController && $request->getActionName() != $loginAction) {
         $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('Redirector');
         $redirector->gotoSimpleAndExit($loginAction, $loginController);
     }
     // User is logged in or on login page.
     if ($auth->hasIdentity()) {
         // Is logged in
         // Let's check the credential
         $acl = new Tynex_Models_TynexAcl();
         $identity = $auth->getIdentity();
         // role is a column in the user table (database)
         $isAllowed = $acl->isAllowed($identity->role, $request->getControllerName(), $request->getActionName());
         if (!$isAllowed) {
             $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('Redirector');
             $redirector->gotoUrlAndExit('/');
         }
     }
 }
开发者ID:razorcell,项目名称:GBADMIN,代码行数:25,代码来源:AccessCheck.php


示例3: routeShutdown

 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     Zend_Layout::getMvcInstance()->setLayout($request->getModuleName());
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/modules/" . $request->getModuleName() . "/layouts/scripts");
     $eh = Zend_Controller_Front::getInstance()->getPlugin("Zend_Controller_Plugin_ErrorHandler");
     $eh->setErrorHandlerModule($request->getModuleName());
 }
开发者ID:nnevala,项目名称:zf-boilerplate,代码行数:7,代码来源:ModuleLayout.php


示例4: postDispatch

 public function postDispatch(Zend_Controller_Request_Abstract $request)
 {
     $layout = Zend_Layout::getMvcInstance();
     // the name "maintenanceMode" is also referred to in the Admin_MaintenanceController,
     // so if you change the filename, it needs to be changed there too
     $maintenanceModeFileName = 'maintenanceMode';
     $register = new Ot_Config_Register();
     $identity = Zend_Auth::getInstance()->getIdentity();
     $role = empty($identity->role) ? $register->defaultRole->getValue() : $identity->role;
     if (isset($identity->masquerading) && $identity->masquerading == true && isset($identity->realAccount) && !is_null($identity->realAccount) && isset($identity->realAccount->role)) {
         $role = $identity->realAccount->role;
     }
     $acl = Zend_Registry::get('acl');
     $view = $layout->getView();
     $viewRenderer = Zend_Controller_Action_HelperBroker::getExistingHelper('ViewRenderer');
     if (is_file(APPLICATION_PATH . '/../overrides/' . $maintenanceModeFileName) && (!$request->isXmlHttpRequest() && !$viewRenderer->getNeverRender())) {
         if (!$acl->isAllowed($role, 'ot_maintenance', 'index')) {
             if (!($request->getModuleName() == 'ot' && $request->getControllerName() == 'login' && $request->getActionName() == 'index')) {
                 $response = $this->getResponse();
                 $layout->disableLayout();
                 $response->setBody($view->maintenanceMode()->publicLayout());
             }
         } else {
             $response = $this->getResponse();
             // there's no point in setting text here if it's a redirect
             if ($response->isRedirect()) {
                 $response->setBody('');
             } else {
                 $response->setBody($view->maintenanceMode()->header() . $response->getBody());
             }
         }
     }
 }
开发者ID:ncsuwebdev,项目名称:otframework,代码行数:33,代码来源:MaintenanceMode.php


示例5: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $context = $request->getHeader('X-Zrt-Format');
     if ($context) {
         $request->setParam('format', $context);
     }
 }
开发者ID:luismayta,项目名称:zrt,代码行数:7,代码来源:ContextDetection.php


示例6: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $storage = new Zend_Auth_Storage_Session();
     $data = $storage->read();
     $role = $data['emprole'];
     if ($role == 1) {
         $role = 'admin';
     }
     $request->getModuleName();
     $request->getControllerName();
     $request->getActionName();
     $module = $request->getModuleName();
     $resource = $request->getControllerName();
     $privilege = $request->getActionName();
     $this->id_param = $request->getParam('id');
     $allowed = false;
     $acl = $this->_getAcl();
     $moduleResource = "{$module}:{$resource}";
     if ($resource == 'profile') {
         $role = 'viewer';
     }
     if ($resource == 'services') {
         $role = 'services';
     }
     if ($role != '') {
         if ($acl->has($moduleResource)) {
             $allowed = $acl->isAllowed($role, $moduleResource, $privilege);
         }
         if (!$allowed) {
             $request->setControllerName('error');
             $request->setActionName('error');
         }
     }
 }
开发者ID:sura2k,项目名称:sentrifugo,代码行数:34,代码来源:AccessControl.php


示例7: preDispatch

 /**
  *
  * @param Zend_Controller_Request_Abstract $request
  */
 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $options = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getApplication()->getOptions();
     $config = new Zend_Config($options);
     $acl = new My_Acl($config);
     $role = 'guest';
     if (Zend_Auth::getInstance()->hasIdentity()) {
         $role = 'user';
         if (Zend_Auth::getInstance()->hasIdentity()) {
             return;
         } else {
             $login = Zend_Auth::getInstance()->getIdentity();
             $user = My_Model::get('Users')->getUserByEmail($login);
             if ($user->admin == 1) {
                 $role = 'admin';
             }
         }
     }
     $controller = $request->getControllerName();
     $action = $request->getActionName();
     $resource = $controller;
     $privilege = $action;
     if (!$acl->has($resource)) {
         $resource = null;
     }
     if (is_null($privilege)) {
         $privilege = 'index';
     }
     if (!$acl->isAllowed($role, $resource, $privilege)) {
         //            $flash = Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger');
         //            $flash->addMessage('Access Denied');
         $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('Redirector');
         $redirector->gotoSimpleAndExit('login', 'admin');
     }
 }
开发者ID:cngroupdk,项目名称:InterviewMe_Tym1,代码行数:39,代码来源:Acl.php


示例8: apply

 /**
  * Apply category filter to layer
  *
  * @param   Zend_Controller_Request_Abstract $request
  * @param   Mage_Core_Block_Abstract $filterBlock
  * @return  Mage_Catalog_Model_Layer_Filter_Category
  */
 public function apply(Zend_Controller_Request_Abstract $request, $filterBlock)
 {
     $layer = Mage::helper('conversionpro')->getCurrentLayer();
     $filter = (int) $request->getParam($this->getRequestVar());
     if (!$filter) {
         return $this;
     }
     $this->_categoryId = Mage::helper('conversionpro')->getCategoryIdByAnswerId($filter);
     Mage::register('current_category_filter', $this->getCategory(), true);
     $this->_appliedCategory = Mage::getModel('catalog/category')->setStoreId(Mage::app()->getStore()->getId())->load($this->_categoryId);
     // For some reason, this class runs twice, and not as a singelton, so we have no way of monitoring
     // whether the state filter was already added or not by using some class parameter. Instead,
     // we're going over all the filters to see if any has 'Category' for the name, and only adding the state
     // tag if we can't find one.
     $isFilterApplied = false;
     $filters = $this->getLayer()->getState()->getFilters();
     foreach ($filters as $filter) {
         if ($filter->getName() == $this->getName()) {
             $isFilterApplied = true;
         }
     }
     //If there's no state tag for the cateogry yet, create it.
     if (!$isFilterApplied) {
         //If this category exists in Magento, it will execute normally. In any other case, we assume that the chosen
         // answer doesn't exist in Magento and apply it as a regular filter. The getCategoryIdByAnswerText() function
         // saves the answer's text to $this->_categoryId in these cases, so we can use that as the state tag's
         // label.
         if ($this->_isValidCategory($this->_appliedCategory)) {
             $this->getLayer()->getState()->addFilter($this->_createItem($this->_appliedCategory->getName(), $this->_categoryId));
         } else {
             $this->getLayer()->getState()->addFilter($this->_createItem($this->_categoryId, $filter));
         }
     }
     return $this;
 }
开发者ID:jokusafet,项目名称:MagentoSource,代码行数:42,代码来源:Category.php


示例9: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     if ($this->_auth->hasIdentity()) {
         $role = $this->_auth->getIdentity()->getUser()->role;
     } else {
         $role = 'guest';
     }
     $controller = $request->controller;
     $action = $request->action;
     $module = $request->module;
     $resource = $controller;
     if (!$this->_acl->has($resource)) {
         $resource = null;
     }
     if (!$this->_acl->isAllowed($role, $resource, $action)) {
         if (!$this->_auth->hasIdentity()) {
             $module = self::NO_AUTH_MODULE;
             $controller = self::NO_AUTH_CONTROLLER;
             $action = self::NO_AUTH_ACTION;
         } else {
             $module = self::NO_ACL_MODULE;
             $controller = self::NO_ACL_CONTROLLER;
             $action = self::NO_ACL_ACTION;
         }
     }
     $request->setModuleName($module);
     $request->setControllerName($controller);
     $request->setActionName($action);
 }
开发者ID:Neozeratul,项目名称:Intermodels,代码行数:29,代码来源:Auth.php


示例10: preDispatch

 /**
  * this function routes all requests that come in to the default module to the index controller / index action
  *
  * @param zend_controller_request $request
  */
 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     if ($request->module == 'public' && $request->controller != 'plugin') {
         $request->setControllerName('index');
         $request->setActionName('index');
     }
 }
开发者ID:ngukho,项目名称:ducbui-cms,代码行数:12,代码来源:SetPagePath.php


示例11: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     //clear session from search session
     //$this->clearSession();
     $session_user = new Zend_Session_Namespace('auth');
     $module = $request->getModuleName();
     $controller = $request->getControllerName();
     $action = $request->getActionName();
     $url = $module . "/" . $controller . "/" . $action;
     $_url = "";
     //have login
     if (isset($session_user->arr_acl)) {
         $arr_acl = $session_user->arr_acl;
         $valid_action = FALSE;
         foreach ($arr_acl as $acl) {
             if ($module == $acl["module"] && $controller == $acl["controller"]) {
                 $valid_action = TRUE;
                 break;
             } elseif ($module === "rsvAcl" && $controller === "user" && $action === "change-password") {
                 //all user level can change password all
                 $valid_action = TRUE;
                 break;
             } elseif ($module === "rsvAcl" && $session_user->level === "1") {
                 //user level 1 can access all action in module "rsvAcl"
                 $valid_action = TRUE;
                 break;
             }
         }
         //redirect to homepage
         if (!$valid_action) {
             //just open block below
             if ($url !== "default/index/index" && $url !== "default/error/error" && $url !== "default/index/changepassword" && $url !== "default/index/logout") {
                 $_url = '/';
             }
             $_have = false;
             foreach ($this->_exception_url as $i => $val) {
                 if ($url === $val) {
                     $_have = true;
                     break;
                 }
             }
             if (!$_have) {
                 $_url = '/';
             }
         } else {
             $_url = $this->rewriteUrl($url);
         }
     } else {
         //no login
         //redirect to login page
         if ($url !== "default/index/index") {
             $_url = "/";
         }
     }
     if (!empty($_url)) {
         // 	 		echo"url here". $_url;exit();
         $_url = "/home";
         Application_Form_FrmMessage::redirectUrl($_url);
     }
 }
开发者ID:samlanh,项目名称:lynacr,代码行数:60,代码来源:CustomAuth.php


示例12: apply

 public function apply(Zend_Controller_Request_Abstract $request, $filterBlock)
 {
     $filter = $request->getParam($this->getRequestVar());
     if (is_null($filter)) {
         return parent::apply($request, $filterBlock);
     }
     if (!is_numeric($filter)) {
         if (Mage::registry('current_category')) {
             $collection = Mage::getModel('catalog/category')->getCollection()->addAttributeToFilter('parent_id', Mage::registry('current_category')->getId())->addAttributeToFilter('is_active', 1)->addAttributeToSelect('name')->addAttributeToFilter('name', $filter);
             $this->_appliedCategory = $collection->getFirstItem();
             if (!$this->_appliedCategory->getProductCollection()->count()) {
                 $this->_appliedCategory = $this->_getCategoryByName($filter);
             }
         } else {
             $this->_appliedCategory = $this->_getCategoryByName($filter);
         }
         if ($this->_appliedCategory) {
             $this->_categoryId = $filter = $this->_appliedCategory->getId();
         }
     } else {
         $this->_categoryId = $filter;
         $this->_appliedCategory = Mage::getModel('catalog/category')->setStoreId(Mage::app()->getStore()->getId())->load($filter);
     }
     if ($this->_isValidCategory($this->_appliedCategory)) {
         $this->getLayer()->getProductCollection()->addCategoryFilter($this->_appliedCategory);
         $this->getLayer()->getState()->addFilter($this->_createItem($this->_appliedCategory->getName(), $filter));
     }
     return $this;
 }
开发者ID:naz-ahmed,项目名称:ndap-magento-mirror,代码行数:29,代码来源:Category.php


示例13: routeShutdown

 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     if (!$this->_domain) {
         $error = false;
         if ($request->getParam('lang') && !$this->_issession) {
             $this->_session->lang = $this->_model->fetchOne('id', array('`stitle` = ?' => $request->getParam('lang')));
             if (!$this->_session->lang) {
                 $error = true;
             }
         }
         $this->_lang = $this->_model->fetchRow(null, '(`id` = ' . (int) $this->_session->lang . ') DESC, (`default` = 1) DESC');
         if ($this->_lang) {
             $this->_lang = new Zkernel_View_Data($this->_lang);
             $this->_lang->session = $this->_issession;
             if (!$this->_domain) {
                 unset($this->_lang->domain);
             }
         }
         $this->_lang->_default = $this->getDefault();
         $this->_lang->_ids = $this->_model->fetchIds();
         $front = Zend_Controller_Front::getInstance();
         $router = $front->getRouter();
         $router->setGlobalParam('lang', $this->_lang->stitle);
         $this->save();
         if ($error) {
             throw new Zend_Controller_Action_Exception('Not Found', 404);
         }
     }
     if (!$this->_domain && !$this->_issession && substr($_SERVER['REQUEST_URI'], 0, 8) == '/control') {
         header('Location: /' . $this->_lang->_default->stitle . $_SERVER['REQUEST_URI'], true, 301);
         exit;
     }
 }
开发者ID:s-kalaus,项目名称:zkernel,代码行数:33,代码来源:Multilang.php


示例14: preDispatch

 /**
  * Add the appropriate view scripts directories for a given request.
  * This is pretty much the glue between the plugin broker and the
  * View object, since it uses data from the plugin broker to determine what
  * script paths will be available to the view.  
  * 
  * @param Zend_Controller_Request_Abstract $request Request object.
  * @return void
  */
 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     // Getting the module name from the request object is pretty much the main
     // reason why this needs to be in a controller plugin and can't be localized
     // to the view script.
     $moduleName = $request->getModuleName();
     $isPluginModule = !in_array($moduleName, array('default', null));
     $themeType = is_admin_theme() ? 'admin' : 'public';
     $pluginScriptDirs = $this->_pluginMvc->getViewScriptDirs($themeType);
     // Remove the current plugin, if any, from the set of "normal" plugin paths
     if ($isPluginModule && isset($pluginScriptDirs[$moduleName])) {
         $currentPluginScriptDirs = $pluginScriptDirs[$moduleName];
         unset($pluginScriptDirs[$moduleName]);
     }
     // Add all the "normal" plugin paths
     foreach ($pluginScriptDirs as $modulePaths) {
         $this->_addPathsToView($modulePaths);
     }
     // Add the theme and core paths
     $this->_addThemePaths($themeType);
     // Add plugin and theme-override paths for current plugin
     if ($isPluginModule) {
         if (isset($currentPluginScriptDirs)) {
             $this->_addPathsToView($currentPluginScriptDirs);
         }
         $this->_addOverridePathForPlugin($themeType, $moduleName);
     }
 }
开发者ID:lchen01,项目名称:STEdwards,代码行数:37,代码来源:ViewScripts.php


示例15: preDispatch

 /**
  * Hlavni logika ACL
  *
  * @param $request
  */
 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $controller = $request->getControllerName();
     $action = $request->getActionName();
     $module = $request->getModuleName();
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $acl = new Zend_Acl();
         $identity = $auth->getIdentity();
         $acl->addRole(new Zend_Acl_Role('user'))->addRole(new Zend_Acl_Role('owner'))->addRole(new Zend_Acl_Role('admin'), 'owner');
         if ($identity->owner == true) {
             $inherit = 'owner';
         } elseif ($identity->administrator == true) {
             $inherit = 'admin';
         } else {
             $inherit = 'user';
         }
         $acl->addRole(new Zend_Acl_Role($identity->email), $inherit);
         $projekt = $request->getParam('projekt');
         // Zakladni resource
         foreach ($this->_resources as $val => $key) {
             $acl->add(new Zend_Acl_Resource($key));
         }
         // Prava pro zakladni resource
         $acl->allow('owner');
         $acl->deny('admin', 'account');
         $acl->allow('user', array('index', 'project', 'assignment', 'calendar', 'people', 'auth', 'redir'));
         $acl->deny('user', 'account');
         $acl->deny('user', 'project', $this->_create);
         $acl->deny('user', 'people', $this->_create);
         $acl->deny('user', 'project', $this->_manage);
         $acl->deny('user', 'people', $this->_manage);
         if ($request->id == $identity->iduser) {
             $acl->allow('user', 'people', $this->_manage);
         }
         // Resource pro projektovou podsekci
         $this->_projectAcl($acl, $identity);
         Zend_Registry::set('acl', $acl);
         if ($identity->administrator == 1) {
             $isAllowed = true;
         } elseif (in_array($projekt . '|' . $request->getControllerName(), $this->_resources)) {
             $isAllowed = $acl->isAllowed($identity->email, $projekt . '|' . $request->getControllerName(), $request->getActionName());
         } elseif (in_array($request->getControllerName(), $this->_resources)) {
             $isAllowed = $acl->isAllowed($identity->email, $request->getControllerName(), $request->getActionName());
         } else {
             $isAllowed = false;
         }
         $error = $request->getParam('error_handler');
         if (is_null($error)) {
             if (!$isAllowed) {
                 $module = $this->_noacl['module'];
                 $controller = $this->_noacl['controller'];
                 $action = $this->_noacl['action'];
             }
         }
         $request->setModuleName($module);
         $request->setControllerName($controller);
         $request->setActionName($action);
     }
 }
开发者ID:besters,项目名称:My-Base,代码行数:65,代码来源:Acl.php


示例16: _login

 protected function _login(Zend_Controller_Request_Abstract $request)
 {
     $userLogin = $request->getPost('login');
     $userName = trim($userLogin['alias']);
     $userPass = trim($userLogin['pass']);
     if ($userName == '') {
         $this->_exceptions[] = self::NO_USERNAME;
         return false;
     }
     if ($userPass == '') {
         $this->_exceptions[] = self::NO_PASSWORD;
         return false;
     }
     $auth = Zend_Auth::getInstance();
     $adapter = new Showcase_Auth_Adapter($userName, $userPass);
     $result = $auth->authenticate($adapter);
     if ($result) {
         if ($result->getCode() !== Zend_Auth_Result::SUCCESS) {
             // Let form know that login has failed...
             $this->_exceptions[] = self::LOGIN_FAILED;
             return false;
         }
         // YAY! Authentication was a success
         return true;
     }
     return false;
 }
开发者ID:roycocup,项目名称:Tests,代码行数:27,代码来源:User.php


示例17: authenticate

 /**
  * Authenticate a user.
  * @param Zend_Controller_Request_Abstract $request The current request
  * @param Zend_Controller_Response_Abstract $response The current response
  * @return Array|Boolean User data, or FALSE
  */
 public function authenticate(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response)
 {
     $authVars = new Garp_Util_Configuration($this->_getAuthVars()->toArray());
     $authVars->obligate('model')->obligate('identityColumn')->obligate('credentialColumn')->setDefault('hashMethod', 'MD5')->setDefault('salt', '');
     if (!$request->getPost($authVars['identityColumn']) || !$request->getPost($authVars['credentialColumn'])) {
         $this->_addError('Insufficient data received');
         return false;
     }
     $identityValue = $request->getPost($authVars['identityColumn']);
     $credentialValue = $request->getPost($authVars['credentialColumn']);
     $ini = Zend_Registry::get('config');
     $sessionColumns = null;
     if (!empty($ini->auth->login->sessionColumns)) {
         $sessionColumns = $ini->auth->login->sessionColumns;
         $sessionColumns = explode(',', $sessionColumns);
     }
     $model = new Model_AuthLocal();
     try {
         $result = $model->tryLogin($identityValue, $credentialValue, $authVars, $sessionColumns);
         return $result->toArray();
     } catch (Garp_Auth_Adapter_Db_UserNotFoundException $e) {
         $this->_addError('The email address is not found');
     } catch (Garp_Auth_Adapter_Db_InvalidPasswordException $e) {
         $this->_addError('The password is invalid');
     }
     return false;
 }
开发者ID:grrr-amsterdam,项目名称:garp3,代码行数:33,代码来源:Db.php


示例18: dispatchLoopStartup

 /**
  * @param Zend_Controller_Request_Abstract $request
  */
 public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
 {
     if (!$request instanceof Zend_Controller_Request_Http) {
         return;
     }
     // Accept URI parameter over Accept header for specifying of desired response format
     $format = $this->getRequest()->getParam('format') ?: $request->getHeader('Accept');
     // @todo Need to look into implementing Accept header supporting multiple types with quality factors
     switch (true) {
         // XML
         case stristr($format, 'text/xml') && !stristr($format, 'html'):
             $request->setParam('format', 'xml');
             break;
             // JSONP/Javascript
         // JSONP/Javascript
         case stristr($format, 'text/javascript'):
             $request->setParam('format', 'js');
             break;
             // JSON
         // JSON
         case stristr($format, 'application/json'):
         default:
             // Note the fall through!
             $request->setParam('format', 'json');
             break;
     }
 }
开发者ID:notmessenger,项目名称:ZF-REST-API,代码行数:30,代码来源:AcceptHandler.php


示例19: process

 public function process(Zend_Controller_Request_Abstract $request)
 {
     //$this->product_id = $request->getPost('id');
     foreach ($request->getParam('inventory') as $key => $value) {
         echo 'key: ' . $key . ' value: ' . $value . '<br/>';
         $v = $this->sanitize($value);
         if (substr($key, 0, 4) == 'sys_' && $key != 'generalImages' && $key != 'id') {
             $this->{$key} = $v;
             $this->inventoryProduct->{$key} = $v;
         } elseif ($key != 'generalImages' && $key != 'id') {
             $this->inventoryProduct->profile->{$key} = $v;
         } else {
             $this->{$key} = $value;
         }
     }
     $this->inventoryProduct->product_id = $this->productID;
     $this->inventoryProduct->uploader_id = $this->userID;
     $this->inventoryProduct->sys_price = $this->sys_price;
     echo 'inventory product_id is: ' . $this->productID;
     if (!$this->_validateOnly && !$this->hasError()) {
         $this->inventoryProduct->save();
     }
     //return true if no errors have occurred
     return !$this->hasError();
 }
开发者ID:vinnivinsachi,项目名称:Vincent-DR,代码行数:25,代码来源:AddBuyNowInventory.php


示例20: apply

 /**
  * Apply decimal range filter to product collection
  *
  * @param Zend_Controller_Request_Abstract $request
  * @param Mage_Catalog_Block_Layer_Filter_Decimal $filterBlock
  * @return Mage_Catalog_Model_Layer_Filter_Decimal
  */
 public function apply(Zend_Controller_Request_Abstract $request, $filterBlock)
 {
     $attributeCode = $this->getAttributeModel()->getAttributeCode();
     /** @var Amasty_Shopby_Helper_Attributes $attributeHelper */
     $attributeHelper = Mage::helper('amshopby/attributes');
     if (!$attributeHelper->lockApplyFilter($attributeCode, 'attr')) {
         return $this;
     }
     if (!$this->calculateRanges()) {
         $this->_items = array($this->_createItem('', 0, 0));
     }
     $filterBlock->setValueFrom(Mage::helper('amshopby')->__('From'));
     $filterBlock->setValueTo(Mage::helper('amshopby')->__('To'));
     $input = $request->getParam($this->getRequestVar());
     $fromTo = $this->_parseRequestedValue($input);
     if (is_null($fromTo)) {
         return $this;
     }
     list($from, $to) = $fromTo;
     $this->_getResource()->applyFilterToCollection($this, $from, $to);
     $filterBlock->setValueFrom($from);
     if ($to > 0) {
         $filterBlock->setValueTo($to);
     } else {
         $filterBlock->setValueTo('');
     }
     $this->getLayer()->getState()->addFilter($this->_createItem($this->_renderItemLabel($from, $to, true), $input));
     if ($this->hideAfterSelection()) {
         $this->_items = array();
     } elseif ($this->calculateRanges()) {
         $this->_items = array($this->_createItem('', 0, 0));
     }
     return $this;
 }
开发者ID:victorkho,项目名称:telor,代码行数:41,代码来源:Decimal.php



注:本文中的Zend_Controller_Request_Abstract类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Zend_Controller_Request_Http类代码示例发布时间:2022-05-23
下一篇:
PHP Zend_Controller_Front类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap