当前位置: 首页>>代码示例>>PHP>>正文


PHP KRequest::method方法代码示例

本文整理汇总了PHP中KRequest::method方法的典型用法代码示例。如果您正苦于以下问题:PHP KRequest::method方法的具体用法?PHP KRequest::method怎么用?PHP KRequest::method使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KRequest的用法示例。


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

示例1: __construct

 public function __construct(KConfigInterface $config)
 {
     parent::__construct($config);
     if (KRequest::type() == 'AJAX' && KRequest::method() == 'POST') {
         $this->unregisterCallback('after.dispatch', array($this, 'forward'));
     }
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:7,代码来源:dispatcher.php

示例2: _initialize

 protected function _initialize($config)
 {
     $config->append(array('request' => array('sort' => 'created_on', 'direction' => 'desc')));
     if (KRequest::method() != 'GET') {
         $config->request->append(array('id' => KRequest::get('post.id', 'int')));
     }
     parent::_initialize($config);
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:8,代码来源:article.php

示例3: canAdd

    public function canAdd()
    {
        $itemid = $this->getRequest()->Itemid;
        $page   = $this->getService('com://site/docman.model.pages')->id($itemid)->getItem();
        $view   = $this->getView()->getName();
        $page_view = $page->query['view'];

        // We only allow these views to have an edit form/add something
        if (!in_array($page_view, array('list', 'document', 'submit'))) {
            return false;
        }

        // User could pass through Joomla menu access checks, so has access
        if ($page->query['view'] === 'submit') {
            return true;
        }

        // If a POST request is made, we need to be sure it's for a document controller
        if (KRequest::method() !== KHttpRequest::GET
            && !in_array($this->getMixer()->getIdentifier()->name, array('document', 'submit'))) {
            return false;
        }

        if ($page_view === 'list')
        {
            // canAdd is being run on a GET request to determine if we should show the add button
            if (KRequest::method() === KHttpRequest::GET)
            {
                // If we are on a certain category make sure user can add something here
                if ($view === 'list' && $this->getRequest()->slug) {
                    $category = $this->getModel()->getItem();

                    return (!$category->isAclable() || $category->canPerform('add'));
                }

                $authorized_categories = $this->getAuthorisedCategories(array('core.create'));

                if ($page->children) {
                    // make sure user can add something to at least one category
                    return (bool) array_intersect($authorized_categories, $page->children);
                }
                else {
                    // top level category link, return true if user can add something to any category
                    return (bool) count($authorized_categories);
                }
            }
            else {
                // POSTing a new document
                // Can only add something to a category reachable by the menu item
                if ($page->children && !in_array($this->_context->data->docman_category_id, $page->children)) {
                    return false;
                }
            }
        }

        return parent::canAdd();
    }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:57,代码来源:executable.php

示例4: _initialize

 protected function _initialize(KConfig $config)
 {
     if (JFactory::getUser()->guest) {
         if (KRequest::method() == KHttpRequest::GET) {
             //Force the view to prevent a redirect
             KRequest::set('get.view', 'login');
             $config->controller = 'login';
         }
     }
     parent::_initialize($config);
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:11,代码来源:dispatcher.php

示例5: _actionDispatch

 protected function _actionDispatch(KCommandContext $context)
 {
     if (KRequest::method() == KHttpRequest::GET) {
         $view = KRequest::get('get.view', 'cmd', $this->_controller);
         if ($view == 'modules' && !KRequest::has('get.application')) {
             $url = clone KRequest::url();
             $url->query['application'] = 'site';
             JFactory::getApplication()->redirect($url);
         }
     }
     return parent::_actionDispatch($context);
 }
开发者ID:raeldc,项目名称:nooku-server,代码行数:12,代码来源:dispatcher.php

示例6: _checkToken

 /**
  * Check the token to prevent CSRF exploits
  *
  * @param   object  The command context
  * @return  boolean Returns FALSE if the check failed. Otherwise TRUE.
  */
 protected function _checkToken(KCommandContext $context)
 {
     //Check the token
     if ($context->caller->isDispatched()) {
         $method = KRequest::method();
         //Only check the token for PUT, DELETE and POST requests
         if ($method != KHttpRequest::GET && $method != KHttpRequest::OPTIONS) {
             if (KRequest::token() !== JUtility::getToken()) {
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:20,代码来源:executable.php

示例7: _actionDispatch

 /**
  * @see KDispatcherAbstract::_actionDispatch()
  */
 protected function _actionDispatch(KCommandContext $context)
 {
     $identifier = clone $this->getIdentifier();
     $identifier->name = 'aliases';
     $identifier->path = array();
     //Load the component aliases
     $this->getService('koowa:loader')->loadIdentifier($identifier);
     //if a command line the either do get or
     //post depending if there are any action
     if (PHP_SAPI == 'cli') {
         $method = KRequest::get('post.action', 'cmd', 'get');
     } elseif (file_exists(JPATH_COMPONENT . '/' . $this->getIdentifier()->package . '.php') || file_exists(JPATH_COMPONENT . '/' . 'admin.' . $this->getIdentifier()->package . '.php')) {
         $method = 'renderlegacy';
     } else {
         $method = strtolower(KRequest::method());
     }
     $result = $this->execute($method, $context);
     return $result;
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:22,代码来源:component.php

示例8: getAction

 /**
  * Get the action 
  *
  * @return	string 	The action to dispatch
  */
 public function getAction()
 {
     //For none GET requests get the action based on action variable or request method
     if (KRequest::method() != KHttpRequest::GET) {
         $action = KRequest::get('post.action', 'cmd', strtolower(KRequest::method()));
     } else {
         $action = $this->getController()->getAction();
     }
     return $action;
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:15,代码来源:abstract.php

示例9: _checkToken

 /**
  * Check the token to prevent CSRF exploits
  *
  * @param   object  The command context
  * @return  boolean Returns FALSE if the check failed. Otherwise TRUE.
  */
 protected function _checkToken(KCommandContext $context)
 {
     //Check the token
     if ($context->caller->isDispatched()) {
         $method = KRequest::method();
         //Only check the token for PUT, DELETE and POST requests
         if ($method != KHttpRequest::GET && $method != KHttpRequest::OPTIONS) {
             $token = version_compare(JVERSION, '3.0', 'ge') ? JSession::getFormToken() : JUtility::getToken();
             if (KRequest::token() !== $token) {
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:Roma48,项目名称:mayak,代码行数:21,代码来源:executable.php

示例10: _loadSite

 /**
  * Load the site
  *
  * This function checks if the site exists in the request, or in the session. If not it
  * falls back on the default site.
  *
  * @param	string	$site 	The name of the site to load
  * @return	void
  * @throws  KException 	If the site could not be found
  * @since	Nooku Server 0.7
  */
 protected function _loadSite($default)
 {
     $method = strtolower(KRequest::method());
     if (KRequest::has($method . '.site')) {
         $site = KRequest::get($method . '.site', 'cmd');
     } else {
         $site = JFactory::getSession()->get('site', $default);
     }
     parent::_loadSite($site);
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:21,代码来源:application.php

示例11: _loadSite

	/**
	 * Load the site
	 * 
	 * This function checks if the site exists in the request, it not it tries
	 * to get the site form the url falling back on the default is no site was
	 * found
	 * 
	 * @param	string	$site 	The name of the site to load
	 * @return	void
	 * @throws  KException 	If the site could not be found
	 * @since	Nooku Server 0.7
	 */
    protected function _loadSite($site)
	{
	    $method = strtolower(KRequest::method());
	    
	    if(!KRequest::has($method.'.site')) 
	    {
		    $uri  =	clone(JURI::getInstance());
	    	$path = trim(str_replace(array(JURI::base(true)), '', $uri->getPath()), '/');
	    	$path = trim(str_replace('index.php', '', $path), '/');
	    	
		    $segments = array();
		    if(!empty($path)) {
			    $segments = explode('/', $path);
		    }

		    if(!empty($segments))
		    {
		        // Check if the site exists
	            if(KFactory::get('com://admin/sites.model.sites')->getList()->find($segments[0])) {
                    $site = array_shift($segments);
                }
		    }
	    } 
	    else $site = KRequest::get($method.'.site', 'cmd');
	    
	    parent::_loadSite($site);
	}
开发者ID:raeldc,项目名称:com_learn,代码行数:39,代码来源:application.php

示例12: checkToken

 /**
  * Check the token
  * 
  * @return  boolean Returns FALSE if the token is not valid or the session timed-out. 
  */
 public function checkToken()
 {
     if (KRequest::method() != KHttpRequest::GET) {
         if (KRequest::token() !== JUtility::getToken()) {
             return false;
         }
     }
     return true;
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:14,代码来源:authorize.php

示例13: _actionDispatch

 /**
  * Dispatch the controller
  *
  * @param   object		A command context object
  * @return	mixed
  */
 protected function _actionDispatch(KCommandContext $context)
 {
     $action = KRequest::get('post.action', 'cmd', strtolower(KRequest::method()));
     if (KRequest::method() != KHttpRequest::GET) {
         $context->data = KRequest::get(strtolower(KRequest::method()), 'raw');
     }
     $result = $this->getController()->execute($action, $context);
     return $result;
 }
开发者ID:raeldc,项目名称:nooku-server,代码行数:15,代码来源:abstract.php

示例14: getMethod

 /**
  * Return if the request is put.
  *
  * @return bool
  */
 public function getMethod()
 {
     return KRequest::method();
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:9,代码来源:request.php

示例15: getRealAction

 /**
  * Get the real action that is was/will be performed relevant for acl checks.
  *
  * @return	 string Action name
  */
 public function getRealAction()
 {
     $action = $this->getAction();
     if (empty($action)) {
         switch (KRequest::method()) {
             case 'GET':
                 //Determine if the action is browse or read based on the view information
                 $view = KRequest::get('get.view', 'cmd');
                 $action = KInflector::isPlural($view) ? 'browse' : 'read';
                 break;
             case 'POST':
                 //If an action override exists in the post request use it
                 if (!($action = KRequest::get('post.action', 'cmd'))) {
                     $action = 'add';
                 }
                 break;
             case 'PUT':
                 $action = 'edit';
                 break;
             case 'DELETE':
                 $action = 'delete';
                 break;
         }
     }
     if ($action == 'apply') {
         $action = 'save';
     }
     if ($action == 'save') {
         $action = (bool) KRequest::get('get.id', 'int') ? 'edit' : 'add';
     }
     return $action;
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:37,代码来源:view.php


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