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

PHP Utility\Hash类代码示例

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

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



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

示例1: dump

 /**
  * {@inheritdoc}
  *
  * @param string $key The identifier to write to.
  * @param array $data The data to dump.
  * @return bool True on success or false on failure.
  */
 public function dump($key, array $data)
 {
     $data = Hash::flatten($data);
     array_walk($data, [$this, '_persist'], $key);
     array_filter($data);
     return (bool) $data;
 }
开发者ID:gourmet,项目名称:aroma,代码行数:14,代码来源:DbConfig.php


示例2: api

 /**
  * Wrap Moxiemanager's api.php in a controller action.
  *
  * @return void
  */
 public function api()
 {
     try {
         $pluginPath = Plugin::path('CkTools');
         define('MOXMAN_CLASSES', $pluginPath . 'src/Lib/moxiemanager/classes');
         define('MOXMAN_PLUGINS', $pluginPath . 'src/Lib/moxiemanager/plugins');
         define('MOXMAN_ROOT', $pluginPath . 'src/Lib/moxiemanager');
         define('MOXMAN_API_FILE', __FILE__);
         $appConfig = Configure::read('CkTools.moxiemanager');
         Configure::load('CkTools.moxiemanager');
         $moxieManagerConfig = Configure::read('moxiemanager');
         if (is_array($appConfig)) {
             $moxieManagerConfig = Hash::merge($moxieManagerConfig, $appConfig);
         }
         $GLOBALS['moxieManagerConfig'] = $moxieManagerConfig;
         require_once MOXMAN_CLASSES . '/MOXMAN.php';
         $context = \MOXMAN_Http_Context::getCurrent();
         $pluginManager = \MOXMAN::getPluginManager();
         foreach ($pluginManager->getAll() as $plugin) {
             if ($plugin instanceof \MOXMAN_Http_IHandler) {
                 $plugin->processRequest($context);
             }
         }
     } catch (Exception $e) {
         \MOXMAN_Exception::printException($e);
     }
     return $this->render(false, false);
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:33,代码来源:MoxiemanagerController.php


示例3: mergeConfig

 /**
  * Merge Configuration
  *
  * @param string $key Configure key
  * @param array $config New configuration to merge
  * @param return array Array of merged configurations
  */
 public static function mergeConfig($key, $config)
 {
     $values = Configure::read($key);
     $values = Hash::merge((array) $values, $config);
     Configure::write($key, $values);
     return $values;
 }
开发者ID:mohammadsaleh,项目名称:spider,代码行数:14,代码来源:Spider.php


示例4: index

 /**
  * Index method
  *
  * @return void
  */
 public function index()
 {
     if ($this->request->is(['post', 'put'])) {
         $settings = $this->Settings->find('all')->all();
         $settings = $this->Settings->patchEntities($settings, $this->request->data()['Setting']);
         $result = $this->Settings->connection()->transactional(function () use($settings) {
             foreach ($settings as $setting) {
                 $result = $this->Settings->save($setting, ['atomic' => false]);
                 if (!$result) {
                     return false;
                 }
             }
             return true;
         });
         if ($result) {
             $settings = $this->Settings->find()->combine('path', 'value')->toArray();
             ksort($settings);
             $settings = Hash::expand($settings);
             Settings::dump('config', 'default', $settings);
             $this->Flash->success('The settings has been saved.');
             $this->redirect(['action' => 'index']);
         } else {
             $this->Flash->error('The settings could not be saved. Please, try again.');
         }
     }
     $settings = $this->Settings->find('extended')->find('editable')->toArray();
     $this->set('settings', $settings['editable']);
 }
开发者ID:mindforce,项目名称:cakephp-rear-engine,代码行数:33,代码来源:SettingsController.php


示例5: __construct

 /**
  * Creates a Transport instance
  *
  * @param array $config transport-specific configuration options
  */
 public function __construct(array $config)
 {
     $config = Hash::merge(Configure::read('Notifications.transports.sms'), $config);
     parent::__construct($config);
     $keys = Configure::read('Notifications.transports.sms');
     $this->_smsClient = new \WebSmsCom_Client($keys['username'], $keys['password'], $keys['gateway']);
 }
开发者ID:codekanzlei,项目名称:cake-notifications,代码行数:12,代码来源:SmsTransport.php


示例6: initialize

 /**
  * Initialization hook method.
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     if (Configure::read('Swagger')) {
         $this->config = Hash::merge(static::$defaultConfig, Configure::read('Swagger'));
     }
 }
开发者ID:alt3,项目名称:cakephp-swagger,代码行数:12,代码来源:AppController.php


示例7: format

 /**
  * Get format permission data.
  *
  * @param $acos
  * @param array $aros
  * @param array $options
  * @return array
  * @SuppressWarnings("unused")
  */
 public function format($acos, array $aros, array $options = [])
 {
     $options = Hash::merge(['perms' => true, 'model' => 'Roles'], $options);
     $permissions = [];
     /** @var \Acl\Model\Entity\Aco $aco */
     foreach ($acos as $aco) {
         $acoId = $aco->get('id');
         $acoAlias = $aco->get('alias');
         $path = $this->Acos->find('path', ['for' => $acoId]);
         $path = join('/', collection($path)->extract('alias')->toArray());
         $data = ['path' => $path, 'alias' => $acoAlias, 'depth' => substr_count($path, '/')];
         foreach ($aros as $key => $aroId) {
             $role = ['foreign_key' => $key, 'model' => $options['model']];
             if ($options['perms']) {
                 $isCheck = $this->check($role, $path);
                 if ($key == Role::ADMIN_ID || $isCheck) {
                     $data['roles'][$key] = 1;
                 } else {
                     $data['roles'][$key] = (int) $isCheck;
                 }
             }
             $permissions[$acoId] = new Data($data);
         }
     }
     return $permissions;
 }
开发者ID:UnionCMS,项目名称:Community,代码行数:35,代码来源:PermissionsTable.php


示例8: beforeDispatch

 /**
  * Callback for Routing.beforeDispatch event.
  *
  * @param \Cake\Event\Event $event The event instance.
  *
  * @return \Cake\Network\Response Response instance.
  */
 public function beforeDispatch(Event $event)
 {
     $request = $event->data['request'];
     $response = $event->data['response'];
     $path = urldecode($request->url);
     if (Configure::read('Glide.secureUrls')) {
         SignatureFactory::create(Security::salt())->validateRequest('/' . $path, $request->query);
     }
     $server = ServerFactory::create(Configure::read('Glide.serverConfig'));
     $cache = Configure::read('Glide.cache');
     if ($cache) {
         $timestamp = $server->getSource()->getTimestamp($server->getSourcePath($path));
         $response->modified($timestamp);
         if (!$response->checkNotModified($request)) {
             $response = $server->getImageResponse($path, $request->query);
         }
         $response->cache($timestamp, $cache);
     } else {
         $response = $server->getImageResponse($path, $request->query);
     }
     $headers = Hash::filter((array) Configure::read('Glide.headers'));
     foreach ($headers as $key => $value) {
         $response->header($key, $value);
     }
     return $response;
 }
开发者ID:josegonzalez,项目名称:cakephp-glide,代码行数:33,代码来源:GlideFilter.php


示例9: resetToken

 /**
  * Resets user token
  *
  * @param string $reference User username or email
  * @param array $options checkActive, sendEmail, expiration
  *
  * @return string
  * @throws InvalidArgumentException
  * @throws UserNotFoundException
  * @throws UserAlreadyActiveException
  */
 public function resetToken($reference, array $options = [])
 {
     if (empty($reference)) {
         throw new InvalidArgumentException(__d('CakeDC/Users', "Reference cannot be null"));
     }
     $expiration = Hash::get($options, 'expiration');
     if (empty($expiration)) {
         throw new InvalidArgumentException(__d('CakeDC/Users', "Token expiration cannot be empty"));
     }
     $user = $this->_getUser($reference);
     if (empty($user)) {
         throw new UserNotFoundException(__d('CakeDC/Users', "User not found"));
     }
     if (Hash::get($options, 'checkActive')) {
         if ($user->active) {
             throw new UserAlreadyActiveException(__d('CakeDC/Users', "User account already validated"));
         }
         $user->active = false;
         $user->activation_date = null;
     }
     if (Hash::get($options, 'ensureActive')) {
         if (!$user['active']) {
             throw new UserNotActiveException(__d('CakeDC/Users', "User not active"));
         }
     }
     $user->updateToken($expiration);
     $saveResult = $this->_table->save($user);
     $template = !empty($options['emailTemplate']) ? $options['emailTemplate'] : 'CakeDC/Users.reset_password';
     if (Hash::get($options, 'sendEmail')) {
         $this->Email->sendResetPasswordEmail($saveResult, null, $template);
     }
     return $saveResult;
 }
开发者ID:cakedc,项目名称:users,代码行数:44,代码来源:PasswordBehavior.php


示例10: setJraOption

 /**
  * Sets a JSON REST API option.
  *
  * @param mixed $path
  * @param mixed $value
  */
 public function setJraOption($path, $value)
 {
     if (!isset($this->jraOptions)) {
         $this->jraOptions = [];
     }
     $this->jraOptions = Hash::insert($this->jraOptions, $path, $value);
 }
开发者ID:bus-factor,项目名称:cakephp-json-rest-api,代码行数:13,代码来源:OptionsTrait.php


示例11: loadDataCsv

 public function loadDataCsv($fileName, $column_list, $delimiter = ",", $array_encoding = 'utf8', $import_encoding = 'sjis-win')
 {
     //保存をするのでモデルを読み込み
     try {
         $data = array();
         $csvData = array();
         $file = fopen($fileName, "r");
         while ($data = $this->fgetcsv_reg($file, 65536, $delimiter)) {
             //CSVファイルを","区切りで配列に
             mb_convert_variables($array_encoding, $import_encoding, $data);
             $csvData[] = $data;
         }
         $i = 0;
         foreach ($csvData as $line) {
             $this_data = array();
             foreach ($column_list as $k => $v) {
                 if (isset($line[$k])) {
                     //先頭と末尾の"を削除
                     $b = $line[$k];
                     //カラムの数だけセット
                     $this_data = Hash::merge($this_data, array($v => $b));
                 } else {
                     $this_data = Hash::merge($this_data, array($v => ''));
                 }
             }
             $data[$i] = $this_data;
             $i++;
         }
     } catch (\Exception $e) {
         return false;
     }
     return $data;
 }
开发者ID:satthi,项目名称:csv-combine-plugin-for-cakephp,代码行数:33,代码来源:CsvImportForm.php


示例12: basepath

 /**
  * Returns the basepath for the current field/data combination.
  * If a `path` is specified in settings, then that will be used as
  * the replacement pattern
  *
  * @return string
  * @throws LogicException if a replacement is not valid for the current dataset
  */
 public function basepath()
 {
     $defaultPath = 'webroot{DS}files{DS}{model}{DS}{field}{DS}';
     $path = Hash::get($this->settings, 'path', $defaultPath);
     if (strpos($path, '{primaryKey}') !== false) {
         if ($this->entity->isNew()) {
             throw new LogicException('{primaryKey} substitution not allowed for new entities');
         }
         if (is_array($this->table->primaryKey())) {
             throw new LogicException('{primaryKey} substitution not valid for composite primary keys');
         }
     }
     $replacements = ['{primaryKey}' => $this->entity->get($this->table->primaryKey()), '{model}' => $this->table->alias(), '{table}' => $this->table->table(), '{field}' => $this->field, '{year}' => date("Y"), '{month}' => date("m"), '{day}' => date("d"), '{time}' => time(), '{microtime}' => microtime(), '{DS}' => DIRECTORY_SEPARATOR];
     if (preg_match_all("/{field-value:(\\w+)}/", $path, $matches)) {
         foreach ($matches[1] as $field) {
             $value = $this->entity->get($field);
             if ($value === null) {
                 throw new LogicException(sprintf('Field value for substitution is missing: %s', $field));
             } elseif (!is_scalar($value)) {
                 throw new LogicException(sprintf('Field value for substitution must be a integer, float, string or boolean: %s', $field));
             } elseif (strlen($value) < 1) {
                 throw new LogicException(sprintf('Field value for substitution must be non-zero in length: %s', $field));
             }
             $replacements[sprintf('{field-value:%s}', $field)] = $value;
         }
     }
     return str_replace(array_keys($replacements), array_values($replacements), $path);
 }
开发者ID:josegonzalez,项目名称:cakephp-upload,代码行数:36,代码来源:DefaultTrait.php


示例13: parseIndexes

 /**
  * Parses a list of arguments into an array of indexes
  *
  * @param array $arguments A list of arguments being parsed
  * @return array
  **/
 public function parseIndexes($arguments)
 {
     $indexes = [];
     $arguments = $this->validArguments($arguments);
     foreach ($arguments as $field) {
         preg_match('/^(\\w*)(?::(\\w*))?(?::(\\w*))?(?::(\\w*))?/', $field, $matches);
         $field = $matches[1];
         $type = Hash::get($matches, 2);
         $indexType = Hash::get($matches, 3);
         $indexName = Hash::get($matches, 4);
         if (in_array($type, ['primary', 'primary_key'])) {
             $indexType = 'primary';
         }
         if ($indexType === null) {
             continue;
         }
         $indexUnique = false;
         if ($indexType == 'primary') {
             $indexUnique = true;
         } elseif ($indexType == 'unique') {
             $indexUnique = true;
         }
         $indexName = $this->getIndexName($field, $indexType, $indexName, $indexUnique);
         if (empty($indexes[$indexName])) {
             $indexes[$indexName] = ['columns' => [], 'options' => ['unique' => $indexUnique, 'name' => $indexName]];
         }
         $indexes[$indexName]['columns'][] = $field;
     }
     return $indexes;
 }
开发者ID:yao-dev,项目名称:blog-mvc.github.io,代码行数:36,代码来源:ColumnParser.php


示例14: index

 /**
  * Index method
  *
  * @return \Cake\Network\Response|null
  */
 public function index()
 {
     // Get all tag IDs associated with members
     $tags = $this->Tags->find('all')->find('forMembers')->select(['id', 'parent_id'])->toArray();
     $memberTagIds = Hash::extract($tags, '{n}.id');
     // Get all of those tags' parent IDs
     $tagParentIds = Hash::extract($tags, '{n}.parent_id');
     // Collect all parent tags that lead from member tags to the tag tree root
     $tagIds = $memberTagIds;
     while (!empty($tagParentIds)) {
         // Search for unrecognized parents
         $parentsToFind = [];
         foreach ($tagParentIds as $tagId) {
             if (!in_array($tagId, $tagIds)) {
                 $parentsToFind[] = $tagId;
             }
         }
         if (empty($parentsToFind)) {
             break;
         }
         // Add these parent tag IDs to the full list
         $additionalTags = $this->Tags->find('all')->where([function ($exp, $q) use($parentsToFind) {
             return $exp->in('id', $parentsToFind);
         }])->select(['id', 'parent_id'])->order(['Tags.name' => 'ASC'])->toArray();
         $tagIds = array_merge(Hash::extract($additionalTags, '{n}.id'), $tagIds);
         // Set up next round of searching for parents
         $tagParentIds = Hash::extract($additionalTags, '{n}.parent_id');
     }
     $tags = $this->Tags->find('all')->find('threaded')->where([function ($exp, $q) use($tagIds) {
         return $exp->in('id', $tagIds);
     }])->select(['id', 'name', 'slug', 'parent_id'])->order(['Tags.name' => 'ASC'])->all();
     $this->set(['pageTitle' => 'Art Tags', 'tags' => $tags, 'memberTagIds' => $memberTagIds]);
 }
开发者ID:PhantomWatson,项目名称:macc,代码行数:38,代码来源:TagsController.php


示例15: _afterIdentifyUser

 /**
  * Update remember me and determine redirect url after user identified
  * @param array $user user data after identified
  * @param bool $socialLogin is social login
  * @return array
  */
 protected function _afterIdentifyUser($user, $socialLogin = false)
 {
     $socialKey = Configure::read('Users.Key.Session.social');
     if (!empty($user)) {
         $this->request->session()->delete($socialKey);
         $this->Auth->setUser($user);
         $event = $this->dispatchEvent(UsersAuthComponent::EVENT_AFTER_LOGIN);
         if (is_array($event->result)) {
             return $this->redirect($event->result);
         }
         $url = $this->Auth->redirectUrl();
         return $this->redirect($url);
     } else {
         $message = __d('Users', 'Username or password is incorrect');
         if ($socialLogin) {
             $socialData = $this->request->session()->read($socialKey);
             $socialDataEmail = null;
             if (!empty($socialData->info)) {
                 $socialDataEmail = Hash::get((array) $socialData->info, Configure::read('data_email_key'));
             }
             $postedEmail = $this->request->data(Configure::read('Users.Key.Data.email'));
             if (Configure::read('Users.Email.required') && empty($socialDataEmail) && empty($postedEmail)) {
                 return $this->redirect(['controller' => 'Users', 'action' => 'socialEmail']);
             }
             $message = __d('Users', 'There was an error associating your social network account');
         }
         $this->Flash->error($message, 'default', [], 'auth');
     }
 }
开发者ID:OrigamiStructures,项目名称:users,代码行数:35,代码来源:LoginTrait.php


示例16: neighbors

 /**
  * @param int $id
  * @param array $options
  *
  * @return array
  */
 public function neighbors($id, array $options = [])
 {
     if (!$id) {
         throw new InvalidArgumentException("The 'id' key is required for find('neighbors')");
     }
     $sortField = $this->_table->hasField('created') ? 'created' : $this->_table->primaryKey();
     $defaults = ['sortField' => $this->_table->alias() . '.' . $sortField];
     $options += $defaults;
     $normalDirection = !empty($options['reverse']) ? false : true;
     $sortDirWord = $normalDirection ? ['ASC', 'DESC'] : ['DESC', 'ASC'];
     $sortDirSymb = $normalDirection ? ['>=', '<='] : ['<=', '>='];
     if (empty($options['value'])) {
         $data = $this->_table->find('all', ['conditions' => [$this->_table->primaryKey() => $id]])->first();
         list($model, $sortField) = pluginSplit($options['sortField']);
         $options['value'] = $data[$sortField];
     }
     $return = [];
     $findOptions = [];
     if (isset($options['contain'])) {
         $findOptions['contain'] = $options['contain'];
     }
     if (!empty($options['fields'])) {
         $findOptions['fields'] = $options['fields'];
     }
     $findOptions['conditions'][$this->_table->alias() . '.' . $this->_table->primaryKey() . ' !='] = $id;
     $prevOptions = $findOptions;
     $prevOptions['conditions'] = Hash::merge($prevOptions['conditions'], [$options['sortField'] . ' ' . $sortDirSymb[1] => $options['value']]);
     $prevOptions['order'] = [$options['sortField'] => $sortDirWord[1]];
     $return['prev'] = $this->_table->find('all', $prevOptions)->first();
     $nextOptions = $findOptions;
     $nextOptions['conditions'] = Hash::merge($nextOptions['conditions'], [$options['sortField'] . ' ' . $sortDirSymb[0] => $options['value']]);
     $nextOptions['order'] = [$options['sortField'] => $sortDirWord[0]];
     $return['next'] = $this->_table->find('all', $nextOptions)->first();
     return $return;
 }
开发者ID:dereuromark,项目名称:cakephp-tools,代码行数:41,代码来源:NeighborBehavior.php


示例17: render

 /**
  * Create and render navigation menu.
  *
  * @param array $items
  * @param string|int $key
  * @param array $options
  * @param int $level
  * @return string
  */
 public function render($key, array $items = [], array $options = [], $level = 1)
 {
     $_options = ['active' => 'active', 'type' => self::MENU_TYPE_COLLAPSE, 'menuAttr' => ['class' => 'menu', 'id' => 'level-' . $level]];
     $counter = 0;
     $out = '';
     $options = Hash::merge($_options, $options);
     $menuAttr = $options['menuAttr'];
     $type = $options['type'];
     $sorted = Hash::sort($items, '{s}.weight', 'ASC');
     foreach ($sorted as $link) {
         $child = '';
         $counter = $counter + 1;
         $title = h($link['title']);
         $liAttr = $this->_setLiAttr($counter, $link, $options);
         $linkAttr = $this->_setLinkAttr($counter, $link, $options);
         if (count($link['children']) > 0) {
             list($child, $link, $linkAttr, $title, $level) = $this->_createChild($key, $link, $level, $linkAttr, $type);
         }
         $title = $this->_createIcon($title, $link);
         $linkItem = $this->link($title, $link['url'], $linkAttr);
         $out .= $this->tag('li', $linkItem . $child, $liAttr);
         $counter++;
     }
     return $this->tag('ul', $out, $menuAttr);
 }
开发者ID:UnionCMS,项目名称:Core,代码行数:34,代码来源:NavHelper.php


示例18: __construct

 /**
  * Class Constructor
  *
  * Merges defaults with
  * - Configure::read(Meta)
  * - Helper options
  * - viewVars _meta
  * in that order (the latter trumps)
  *
  * @param array $options
  */
 public function __construct(View $View, $options = [])
 {
     parent::__construct($View, $options);
     $configureMeta = (array) Configure::read('Meta');
     if (Configure::read('Meta.robots') && is_array(Configure::read('Meta.robots'))) {
         $configureMeta['robots'] = Hash::merge($this->meta['robots'], Configure::read('Meta.robots'));
     }
     $this->meta = $configureMeta + $this->meta;
     if (!empty($options['robots']) && is_array($options['robots'])) {
         $options['robots'] = Hash::merge($this->meta['robots'], $options['robots']);
     }
     $this->meta = $options + $this->meta;
     if (!empty($this->_View->viewVars['_meta'])) {
         $viewVarsMeta = (array) $this->_View->viewVars['_meta'];
         if (!empty($viewVarsMeta['robots']) && is_array($viewVarsMeta['robots'])) {
             $viewVarsMeta['robots'] = Hash::merge($this->meta['robots'], $viewVarsMeta['robots']);
         }
         $this->meta = $viewVarsMeta + $this->meta;
     }
     if ($this->meta['charset'] === null) {
         // By default include this
         $this->meta['charset'] = true;
     }
     if ($this->meta['icon'] === null) {
         // By default include this
         $this->meta['icon'] = true;
     }
     if ($this->meta['title'] === null) {
         $this->meta['title'] = __(Inflector::humanize(Inflector::underscore($this->request->params['controller']))) . ' - ' . __(Inflector::humanize(Inflector::underscore($this->request->params['action'])));
     }
 }
开发者ID:dereuromark,项目名称:cakephp-meta,代码行数:42,代码来源:MetaHelper.php


示例19: counter

 /**
  * Returns a counter string for the paged result set
  *
  * ### Options
  *
  * - `model` The model to use, defaults to PaginatorHelper::defaultModel();
  * - `format` The format string you want to use, defaults to 'pages' Which generates output like '1 of 5'
  *    set to 'range' to generate output like '1 - 3 of 13'. Can also be set to a custom string, containing
  *    the following placeholders `{{page}}`, `{{pages}}`, `{{current}}`, `{{count}}`, `{{model}}`, `{{start}}`, `{{end}}` and any
  *    custom content you would like.
  *
  * @param string|array $options Options for the counter string. See #options for list of keys.
  *   If string it will be used as format.
  * @return string Counter string.
  * @link http://book.cakephp.org/3.0/en/views/helpers/paginator.html#creating-a-page-counter
  */
 public function counter($options = [])
 {
     if (is_string($options)) {
         $options = ['format' => $options];
     }
     $default = ['model' => $this->defaultModel(), 'format' => 'pages'];
     $options = \Cake\Utility\Hash::merge($default, $options);
     $paging = $this->params($options['model']);
     if (!$paging['pageCount']) {
         $paging['pageCount'] = 1;
     }
     $start = 0;
     if ($paging['count'] >= 1) {
         $start = ($paging['page'] - 1) * $paging['perPage'] + 1;
     }
     $end = $start + $paging['perPage'] - 1;
     if ($paging['count'] < $end) {
         $end = $paging['count'];
     }
     switch ($options['format']) {
         case 'range':
         case 'pages':
             $template = 'counter' . ucfirst($options['format']);
             break;
         default:
             $template = 'counterCustom';
             $this->templater()->add([$template => $options['format']]);
     }
     $map = array_map([$this->Number, 'format'], ['page' => $paging['page'], 'pages' => $paging['pageCount'], 'current' => $paging['current'], 'count' => $paging['count'], 'start' => $start, 'end' => $end]);
     $map += ['model' => strtolower(Inflector::humanize(Inflector::tableize($options['model'])))];
     return $this->templater()->format($template, $map);
 }
开发者ID:lucasnpinheiro,项目名称:Kiterp,代码行数:48,代码来源:MyPaginatorHelper.php


示例20: getUser

 public function getUser(Request $request)
 {
     if (!isset($_SESSION)) {
         return false;
     }
     $provider = Hash::get($_SESSION, 'opauth.auth.provider');
     if (!$provider) {
         return false;
     }
     $uid = Hash::get($_SESSION, 'opauth.auth.uid');
     if (!$uid) {
         return false;
     }
     $userModel = $this->_config['userModel'];
     list(, $model) = pluginSplit($userModel);
     $fields = $this->_config['fields'];
     $conditions = [$model . '.' . $fields['auth_provider'] => $provider, $model . '.' . $fields['auth_uid'] => $uid];
     $scope = $this->_config['scope'];
     if ($scope) {
         $conditions = array_merge($conditions, $scope);
     }
     $table = TableRegistry::get($userModel)->find('all');
     $contain = $this->_config['contain'];
     if ($contain) {
         $table = $table->contain($contain);
     }
     $result = $table->where($conditions)->hydrate(false)->first();
     if (empty($result)) {
         return false;
     }
     return $result;
 }
开发者ID:ukatama,项目名称:cakephp3_opauthlogin,代码行数:32,代码来源:OpauthLoginAuthenticate.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Utility\Inflector类代码示例发布时间:2022-05-23
下一篇:
PHP TestSuite\TestCase类代码示例发布时间: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