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


PHP CakeRequest::query方法代码示例

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


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

示例1: setVisibleContent

 /**
  * Set output of book content.
  *
  * @access private
  * @return void
  */
 private function setVisibleContent()
 {
     $book = $this->epub;
     $component = $this->cakeRequest->query('comp');
     $callback = function ($m) use($book, $component) {
         $method = $m[1];
         $path = $m[2];
         $end = '';
         if (preg_match('/^src\\s*:/', $method)) {
             $end = ')';
         }
         if (preg_match('/^#/', $path)) {
             return $method . '\'' . $path . '\'' . $end;
         }
         $hash = '';
         if (preg_match('/^(.+)#(.+)$/', $path, $matches)) {
             $path = $matches[1];
             $hash = '#' . $matches[2];
         }
         $comp = $book->getComponentName($component, $path);
         if (!$comp) {
             return $method . '\'#\'' . $end;
         }
         $out = $method . '\'?comp=' . $comp . $hash . '\'' . $end;
         return $end ? $out : str_replace('&', '&', $out);
     };
     $content = preg_replace_callback(array('/(src\\s*:\\s*url\\()(.*?)\\)/', '/(\\@import\\s+)["\'](.*?)["\'];/', '/(href=)["\']([^:]*?)["\']/', '/(src=)["\']([^:]*?)["\']/'), $callback, $book->component($component));
     header('Pragma: public');
     header('Cache-Control: maxage=' . 1209600);
     header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 1209600) . ' GMT');
     header('Content-Type: ' . $book->componentContentType($component));
     print $content;
     exit;
 }
开发者ID:cc2i,项目名称:calibrephp,代码行数:40,代码来源:ReaderEPUB.php

示例2: authenticate

 public function authenticate(CakeRequest $request, CakeResponse $response)
 {
     $params = json_decode($request->query('params'), true);
     if (!isset($params['username'])) {
         $params = json_decode($request->data('params'), true);
     }
     $options = array('conditions' => array('User.username' . $this->userController->User->username => $params['username']));
     $result = $this->userController->User->find('first', $options);
     if ($result) {
         $password = sha1($result['User']['username'] . $result['User']['password']);
         if ("Promobot" . $password == $params['auth']) {
             return $result['User'];
         }
     }
     return false;
 }
开发者ID:JesusRugama,项目名称:Promobot,代码行数:16,代码来源:AppAuthenticate.php

示例3: testQueryWithArray

 /**
  * Test the query() method with arrays passed via $_GET
  *
  * @return void
  */
 public function testQueryWithArray()
 {
     $_GET = array();
     $_GET['test'] = array('foo', 'bar');
     $request = new CakeRequest();
     $result = $request->query('test');
     $this->assertEquals(array('foo', 'bar'), $result);
     $result = $request->query('test.1');
     $this->assertEquals('bar', $result);
     $result = $request->query('test.2');
     $this->assertNull($result);
 }
开发者ID:xMyThoLoGyx,项目名称:centremedicaletp3,代码行数:17,代码来源:CakeRequestTest.php

示例4: _getRequestParameters

 /**
  * return request params
  *
  * @return array
  */
 protected function _getRequestParameters(CakeRequest $request)
 {
     //if (strpos($request->getRequestUri(), '&') === false) {
     //$this->_logger->debug('Requested url: ' . print_r($request->query, true));
     //$this->_logger->debug('Empty query: ' . print_r(empty($request->query), true));
     //$this->_logger->debug('Count query: ' . print_r(count($request->query), true));
     //if (strpos($request->url, '&') === false) {
     if (count($request->query) <= 1) {
         $this->_logger->debug('Non query request');
         $commands = array(0 => 'Sync', 1 => 'SendMail', 2 => 'SmartForward', 3 => 'SmartReply', 4 => 'GetAttachment', 9 => 'FolderSync', 10 => 'FolderCreate', 11 => 'FolderDelete', 12 => 'FolderUpdate', 13 => 'MoveItems', 14 => 'GetItemEstimate', 15 => 'MeetingResponse', 16 => 'Search', 17 => 'Settings', 18 => 'Ping', 19 => 'ItemOperations', 20 => 'Provision', 21 => 'ResolveRecipients', 22 => 'ValidateCert');
         //$requestParameters = substr($request->getRequestUri(), strpos($request->getRequestUri(), '?'));
         $requestParameters = substr($request->url, strpos($request->url, '?'));
         $stream = fopen("php://temp", 'r+');
         fwrite($stream, base64_decode($requestParameters));
         rewind($stream);
         // unpack the first 4 bytes
         $unpacked = unpack('CprotocolVersion/Ccommand/vlocale', fread($stream, 4));
         // 140 => 14.0
         $protocolVersion = substr($unpacked['protocolVersion'], 0, -1) . '.' . substr($unpacked['protocolVersion'], -1);
         $command = $commands[$unpacked['command']];
         $locale = $unpacked['locale'];
         // unpack deviceId
         $length = ord(fread($stream, 1));
         if ($length > 0) {
             $toUnpack = fread($stream, $length);
             $unpacked = unpack("H" . $length * 2 . "string", $toUnpack);
             $deviceId = $unpacked['string'];
         }
         // unpack policyKey
         $length = ord(fread($stream, 1));
         if ($length > 0) {
             $unpacked = unpack('Vstring', fread($stream, $length));
             $policyKey = $unpacked['string'];
         }
         // unpack device type
         $length = ord(fread($stream, 1));
         if ($length > 0) {
             $unpacked = unpack('A' . $length . 'string', fread($stream, $length));
             $deviceType = $unpacked['string'];
         }
         while (!feof($stream)) {
             $tag = ord(fread($stream, 1));
             $length = ord(fread($stream, 1));
             switch ($tag) {
                 case self::PARAMETER_ATTACHMENTNAME:
                     $unpacked = unpack('A' . $length . 'string', fread($stream, $length));
                     $attachmentName = $unpacked['string'];
                     break;
                 case self::PARAMETER_COLLECTIONID:
                     $unpacked = unpack('A' . $length . 'string', fread($stream, $length));
                     $collectionId = $unpacked['string'];
                     break;
                 case self::PARAMETER_ITEMID:
                     $unpacked = unpack('A' . $length . 'string', fread($stream, $length));
                     $itemId = $unpacked['string'];
                     break;
                 case self::PARAMETER_OPTIONS:
                     $options = ord(fread($stream, 1));
                     $saveInSent = !!($options & 0x1);
                     $acceptMultiPart = !!($options & 0x2);
                     break;
                 default:
                     if ($this->_logger instanceof Syncroton_Log) {
                         $this->_logger->critical(__METHOD__ . '::' . __LINE__ . " found unhandled command parameters");
                     }
             }
         }
         $result = array('protocolVersion' => $protocolVersion, 'command' => $command, 'deviceId' => $deviceId, 'deviceType' => isset($deviceType) ? $deviceType : null, 'policyKey' => isset($policyKey) ? $policyKey : null, 'saveInSent' => isset($saveInSent) ? $saveInSent : false, 'collectionId' => isset($collectionId) ? $collectionId : null, 'itemId' => isset($itemId) ? $itemId : null, 'attachmentName' => isset($attachmentName) ? $attachmentName : null, 'acceptMultipart' => isset($acceptMultiPart) ? $acceptMultiPart : false);
     } else {
         $result = array('protocolVersion' => $request->header('MS_ASPROTOCOLVERSION'), 'command' => $request->query('Cmd'), 'deviceId' => $request->query('DeviceId'), 'deviceType' => $request->query('DeviceType'), 'policyKey' => $request->header('X_MS_POLICYKEY'), 'saveInSent' => $request->query('SaveInSent') == 'T', 'collectionId' => $request->query('CollectionId'), 'itemId' => $request->query('ItemId'), 'attachmentName' => $request->query('AttachmentName'), 'acceptMultipart' => $request->header('MS_ASACCEPTMULTIPART') == 'T');
     }
     $result['userAgent'] = env('HTTP_USER_AGENT', $result['deviceType']);
     $result['contentType'] = env('CONTENT_TYPE');
     //$this->_logger->debug('Query result: ' . print_r($result, true));
     return $result;
 }
开发者ID:malamalca,项目名称:lil-activesync,代码行数:81,代码来源:Server.php


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