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


PHP CakeRequest::here方法代码示例

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


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

示例1: matchCurrentRoute

 /**
  * @return array|bool
  */
 public function matchCurrentRoute()
 {
     $context = new RequestContext();
     $matcher = new UrlMatcher($this->routes, $context);
     $request = new CakeRequest();
     try {
         return $matcher->match($request->here());
     } catch (Exception $e) {
         //route is not registered in yml file
         return false;
     }
 }
开发者ID:piotrpasich,项目名称:cakephp-symfony-router,代码行数:15,代码来源:SymfonyRouter.php

示例2: dispatch

 /**
  * Dispatches and invokes given Request, handing over control to the involved controller. If the controller is set
  * to autoRender, via Controller::$autoRender, then Dispatcher will render the view.
  *
  * Actions in CakePHP can be any public method on a controller, that is not declared in Controller.  If you
  * want controller methods to be public and in-accessible by URL, then prefix them with a `_`.
  * For example `public function _loadPosts() { }` would not be accessible via URL.  Private and protected methods
  * are also not accessible via URL.
  *
  * If no controller of given name can be found, invoke() will throw an exception.
  * If the controller is found, and the action is not found an exception will be thrown.
  *
  * @param CakeRequest $request Request object to dispatch.
  * @param CakeResponse $response Response object to put the results of the dispatch into.
  * @param array $additionalParams Settings array ("bare", "return") which is melded with the GET and POST params
  * @return boolean Success
  * @throws MissingControllerException When the controller is missing.
  */
 public function dispatch(CakeRequest $request, CakeResponse $response, $additionalParams = array())
 {
     if ($this->asset($request->url, $response) || $this->cached($request->here())) {
         return;
     }
     Router::setRequestInfo($request);
     $request = $this->parseParams($request, $additionalParams);
     $controller = $this->_getController($request, $response);
     if (!$controller instanceof Controller) {
         throw new MissingControllerException(array('class' => Inflector::camelize($request->params['controller']) . 'Controller', 'plugin' => empty($request->params['plugin']) ? null : Inflector::camelize($request->params['plugin'])));
     }
     return $this->_invoke($controller, $request, $response);
 }
开发者ID:gilyaev,项目名称:framework-bench,代码行数:31,代码来源:Dispatcher.php

示例3: _validatePost

 /**
  * Validate submitted form
  *
  * @param Controller $controller Instantiating controller
  * @return bool true if submitted form is valid
  */
 protected function _validatePost(Controller $controller)
 {
     if (empty($controller->request->data)) {
         return true;
     }
     $data = $controller->request->data;
     if (!isset($data['_Token']) || !isset($data['_Token']['fields']) || !isset($data['_Token']['unlocked'])) {
         return false;
     }
     $locked = '';
     $check = $controller->request->data;
     $token = urldecode($check['_Token']['fields']);
     $unlocked = urldecode($check['_Token']['unlocked']);
     if (strpos($token, ':')) {
         list($token, $locked) = explode(':', $token, 2);
     }
     unset($check['_Token']);
     $locked = explode('|', $locked);
     $unlocked = explode('|', $unlocked);
     $lockedFields = array();
     $fields = Hash::flatten($check);
     $fieldList = array_keys($fields);
     $multi = array();
     foreach ($fieldList as $i => $key) {
         if (preg_match('/(\\.\\d+){1,10}$/', $key)) {
             $multi[$i] = preg_replace('/(\\.\\d+){1,10}$/', '', $key);
             unset($fieldList[$i]);
         }
     }
     if (!empty($multi)) {
         $fieldList += array_unique($multi);
     }
     $unlockedFields = array_unique(array_merge((array) $this->disabledFields, (array) $this->unlockedFields, $unlocked));
     foreach ($fieldList as $i => $key) {
         $isLocked = is_array($locked) && in_array($key, $locked);
         if (!empty($unlockedFields)) {
             foreach ($unlockedFields as $off) {
                 $off = explode('.', $off);
                 $field = array_values(array_intersect(explode('.', $key), $off));
                 $isUnlocked = $field === $off;
                 if ($isUnlocked) {
                     break;
                 }
             }
         }
         if ($isUnlocked || $isLocked) {
             unset($fieldList[$i]);
             if ($isLocked) {
                 $lockedFields[$key] = $fields[$key];
             }
         }
     }
     sort($unlocked, SORT_STRING);
     sort($fieldList, SORT_STRING);
     ksort($lockedFields, SORT_STRING);
     $fieldList += $lockedFields;
     $unlocked = implode('|', $unlocked);
     $hashParts = array($this->request->here(), serialize($fieldList), $unlocked, Configure::read('Security.salt'));
     $check = Security::hash(implode('', $hashParts), 'sha1');
     return $token === $check;
 }
开发者ID:noibilism,项目名称:nst_portal,代码行数:67,代码来源:SecurityComponent.php

示例4: testHereWithSpaceInUrl

 /**
  * Test the here() with space in URL
  *
  * @return void
  */
 public function testHereWithSpaceInUrl()
 {
     Configure::write('App.base', '');
     $_GET = array('/admin/settings/settings/prefix/Access_Control' => '');
     $request = new CakeRequest('/admin/settings/settings/prefix/Access%20Control');
     $result = $request->here();
     $this->assertEquals('/admin/settings/settings/prefix/Access%20Control', $result);
 }
开发者ID:xMyThoLoGyx,项目名称:centremedicaletp3,代码行数:13,代码来源:CakeRequestTest.php

示例5: makeRedirectUrl

 /**
  * リクエストをリダイレクトするURLを生成
  *
  * @param CakeRequest $request リクエスト
  * @return string
  */
 public function makeRedirectUrl(CakeRequest $request)
 {
     $hereWithQuery = $request->here(false);
     $alias = static::extractAlias($request->url);
     if (is_null($alias)) {
         return "{$this->alias}{$hereWithQuery}";
     }
     $replacedUrl = preg_replace('/^\\/' . $alias . '/', $this->alias, $hereWithQuery);
     return $replacedUrl;
 }
开发者ID:kenz,项目名称:basercms,代码行数:16,代码来源:BcAgent.php

示例6: testHere

 /**
  * test the here() method
  *
  * @return void
  */
 public function testHere()
 {
     Configure::write('App.base', '/base_path');
     $_GET = array('test' => 'value');
     $request = new CakeRequest('/posts/add/1/name:value');
     $result = $request->here();
     $this->assertEquals('/base_path/posts/add/1/name:value?test=value', $result);
     $result = $request->here(false);
     $this->assertEquals('/posts/add/1/name:value?test=value', $result);
     $request = new CakeRequest('/posts/base_path/1/name:value');
     $result = $request->here();
     $this->assertEquals('/base_path/posts/base_path/1/name:value?test=value', $result);
     $result = $request->here(false);
     $this->assertEquals('/posts/base_path/1/name:value?test=value', $result);
 }
开发者ID:nabeelio,项目名称:CakePHP-Base,代码行数:20,代码来源:CakeRequestTest.php

示例7: makeUrl

 /**
  * エイリアスを反映したURLを生成
  * 同一URL設定のみ利用可
  *
  * @param CakeRequest $request リクエスト
  * @return string
  */
 public function makeUrl(CakeRequest $request)
 {
     $here = $request->here(false);
     if ($this->alias) {
         return "/{$this->alias}{$here}";
     } else {
         return $here;
     }
 }
开发者ID:baserproject,项目名称:basercms,代码行数:16,代码来源:BcSite.php


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