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


PHP Hash::remove方法代码示例

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


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

示例1: beforeRender

 /**
  * Called before the Controller::beforeRender(), and before
  * the view class is loaded, and before Controller::render()
  *
  * @param Controller $controller Controller with components to beforeRender
  * @return void
  * @link http://book.cakephp.org/2.0/en/controllers/components.html#Component::beforeRender
  */
 public function beforeRender(Controller $controller)
 {
     //RequestActionの場合、スキップする
     if (!empty($controller->request->params['requested'])) {
         return;
     }
     $this->controller = $controller;
     //RoomRolePermissionデータセット
     if (isset($this->settings['room_id'])) {
         $roomId = $this->settings['room_id'];
     } else {
         $roomId = null;
     }
     if (isset($this->settings['type'])) {
         $type = $this->settings['type'];
     } else {
         $type = null;
     }
     if (isset($this->settings['permissions'])) {
         $results = $this->NetCommonsRoomRole->getRoomRolePermissions($roomId, $this->settings['permissions'], $type);
         $defaultPermissions = Hash::remove($results['DefaultRolePermission'], '{s}.{s}.id');
         $results['RoomRolePermission'] = Hash::merge($defaultPermissions, $results['RoomRolePermission']);
         $this->controller->request->data = Hash::merge($this->controller->request->data, $results);
     }
 }
开发者ID:Onasusweb,项目名称:Rooms,代码行数:33,代码来源:RoomsRolesFormComponent.php

示例2: getUserTags

 /**
  * Gets Tags belonging to a User.
  *
  * @param array
  * @return array
  */
 public function getUserTags($user, $data)
 {
     // Build the query array using the request parameters
     $query = array();
     // Contain
     $query['contain'] = array('Resource' => array('conditions' => array('Resource.user_id' => $user)));
     // Joins
     $query['joins'] = array(array('table' => 'resources_tags', 'alias' => 'ResourcesTag', 'type' => 'inner', 'conditions' => array('Tag.id = ResourcesTag.tag_id')), array('table' => 'resources', 'alias' => 'Resource', 'type' => 'inner', 'conditions' => array('ResourcesTag.resource_id = Resource.id')));
     // Conditions
     $query['conditions']['Resource.user_id'] = $user;
     // Set conditions
     if (isset($data['parameters']['set']) && $data['parameters']['set']) {
         $query['conditions']['Set.slug'] = $data['parameters']['set'];
     }
     // Fields
     $query['fields'] = array('Tag.name');
     // Order
     $query['order'] = array('Tag.name ASC');
     // Group
     $query['group'] = array('Tag.id');
     // Execute the query
     $this->recursive = -1;
     $tags = $this->find('all', $query);
     // Purge and reformat the data
     $tags = Hash::remove($tags, '{n}.Tag.id');
     foreach ($tags as &$tag) {
         $tag['Tag']['count'] = count($tag['Resource']);
     }
     $tags = Hash::remove($tags, '{n}.Resource');
     return $tags;
 }
开发者ID:bretten,项目名称:resource_ms,代码行数:37,代码来源:Tag.php

示例3: before

 /**
  * Before migration callback
  *
  * @param string $direction Direction of migration process (up or down)
  * @return bool Should process continue
  */
 public function before($direction)
 {
     if ($direction === 'up') {
         $Model = ClassRegistry::init('SiteManager.SiteSetting');
         $dataSource = $Model->getDataSource();
         $searchType = SiteSetting::DATABASE_SEARCH_LIKE;
         $hasMroonga = false;
         if ($dataSource->config['datasource'] === 'Database/Mysql') {
             $result = $Model->query('SELECT * FROM information_schema.ENGINES');
             $engines = Hash::extract($result, '{n}.ENGINES.ENGINE');
             $mysql56 = (bool) version_compare($dataSource->getVersion(), '5.6', '>=');
             if ($mysql56) {
                 $searchType = SiteSetting::DATABASE_SEARCH_MATCH_AGAIN;
             } elseif (in_array('Mroonga', $engines, true)) {
                 //$searchType = 'match_against';
                 //$hasMroonga = true;
             }
         }
         if ($searchType === SiteSetting::DATABASE_SEARCH_LIKE) {
             //インデックスが使われないため、検索用のインデックス(FullText)は削除する
             $this->migration = Hash::remove($this->migration, 'up.create_table.topics.indexes.search');
         }
         if (!$hasMroonga) {
             $this->migration = Hash::insert($this->migration, 'up.create_table.topics.tableParameters.engine', 'InnoDB');
             $this->migration = Hash::remove($this->migration, 'up.create_table.topics.tableParameters.comment', null);
         }
         $record = array('language_id' => 0, 'key' => 'Search.type', 'value' => $searchType);
         $Model->create();
         if (!$Model->save($record, false)) {
             return false;
         }
     }
     return true;
 }
开发者ID:s-nakajima,项目名称:Topics,代码行数:40,代码来源:1462148437_init.php

示例4: testSave

 /**
  * Save(公開)のテスト
  *
  * @param array $data 登録データ
  * @dataProvider dataProviderSave
  * @return array 登録後のデータ
  */
 public function testSave($data)
 {
     $model = $this->_modelName;
     $method = $this->_methodName;
     $created = !isset($data[$this->{$model}->alias]['id']);
     //チェック用データ取得
     if (!$created) {
         $before = $this->{$model}->find('first', array('recursive' => -1, 'conditions' => array('id' => $data[$this->{$model}->alias]['id'])));
         $saveData = Hash::remove($data, $this->{$model}->alias . '.id');
     } else {
         $saveData = $data;
         $before[$this->{$model}->alias] = array();
     }
     //テスト実行
     $result = $this->{$model}->{$method}($saveData);
     $this->assertNotEmpty($result);
     $id = $this->{$model}->getLastInsertID();
     //is_latestのチェック
     if (!$created) {
         $after = $this->{$model}->find('first', array('recursive' => -1, 'conditions' => array('id' => $data[$this->{$model}->alias]['id'])));
         $this->assertEquals($after, Hash::merge($before, array($this->{$model}->alias => array('is_latest' => false))));
     }
     //更新のチェック
     $actual = $this->_getActual($id, $created);
     $expected = $this->_getExpected($id, $data, $before, $created);
     $this->assertEquals($expected, $actual);
     return $actual;
 }
开发者ID:NetCommons3,项目名称:Workflow,代码行数:35,代码来源:WorkflowSaveTest.php

示例5: edit

 /**
  * edit
  *
  * @return void
  */
 public function edit()
 {
     //事前準備
     $this->__prepare();
     //リクエストセット
     if ($this->request->is('post')) {
         $this->set('membershipTab', Hash::get($this->request->data['SiteSetting'], 'membershipTab', 'automatic-registration'));
         $this->request->data['SiteSetting'] = Hash::remove($this->request->data['SiteSetting'], 'membershipTab');
         $automaticInputItems = Hash::get($this->request->data, '_siteManager.automaticInputItems', 'false');
         $this->Session->write('automaticInputItems', $automaticInputItems);
         $this->__parseRequestData();
         $this->SiteSetting->autoRegistRoles = $this->viewVars['userRoles'];
         //登録処理
         $redirect = Router::parse($this->referer());
         $redirect['?'] = array('membershipTab' => $this->viewVars['membershipTab']);
         $this->SiteManager->saveData($redirect);
     } else {
         $this->set('membershipTab', Hash::get($this->request->query, 'membershipTab', 'automatic-registration'));
         if ($this->Session->read('automaticInputItems')) {
             $automaticInputItems = $this->Session->read('automaticInputItems');
             $this->Session->delete('automaticInputItems');
         } else {
             $automaticInputItems = 'false';
         }
         $this->request->data['SiteSetting'] = $this->SiteSetting->getSiteSettingForEdit(array('SiteSetting.key' => array('AutoRegist.use_automatic_register', 'AutoRegist.confirmation', 'AutoRegist.use_secret_key', 'AutoRegist.secret_key', 'AutoRegist.role_key', 'AutoRegist.prarticipate_default_room', 'AutoRegist.disclaimer', 'AutoRegist.approval_mail_subject', 'AutoRegist.approval_mail_body', 'AutoRegist.acceptance_mail_subject', 'AutoRegist.acceptance_mail_body', 'UserRegist.mail_subject', 'UserRegist.mail_body', 'UserCancel.use_cancel_feature', 'UserCancel.disclaimer', 'UserCancel.notify_administrators', 'UserCancel.mail_subject', 'UserCancel.mail_body')));
     }
     $this->set('automaticInputItems', $automaticInputItems);
 }
开发者ID:NetCommons3,项目名称:SiteManager,代码行数:33,代码来源:MembershipController.php

示例6: testUpdateRssReaderItems

 /**
  * Expect RssReaderItem->updateRssReaderItems()
  *
  * @return void
  */
 public function testUpdateRssReaderItems()
 {
     $rssReaderId = 1;
     //コンテンツの公開権限true
     $this->RssReader->Behaviors->attach('Publishable');
     $this->RssReader->Behaviors->Publishable->setup($this->RssReader, ['contentPublishable' => true]);
     //データ生成
     $rssReader = $this->RssReader->find('first', array('recursive' => -1, 'conditions' => array('id' => $rssReaderId)));
     $url = APP . 'Plugin' . DS . 'RssReaders' . DS . 'Test' . DS . 'Fixture' . DS . 'rss_v1.xml';
     $xmlData = $this->RssReaderItem->serializeXmlToArray($url);
     $xmlData = Hash::insert($xmlData, '{n}.rss_reader_id', $rssReaderId);
     $data = array('RssReader' => $rssReader['RssReader'], 'RssReaderItem' => $xmlData);
     //登録処理実行
     $this->RssReaderItem->updateRssReaderItems($data);
     //期待値の生成
     $expected = $data;
     //RssReaderのテスト実施
     $now = date('Y-m-d H:i:s');
     $rssReader = $this->RssReader->find('first', array('recursive' => -1, 'conditions' => array('id' => $rssReaderId)));
     $date = new DateTime($rssReader['RssReader']['modified']);
     $this->assertTrue($date->format('Y-m-d H:i:s') <= $now);
     //RssReaderItemのテスト実施
     $result = $this->RssReaderItem->find('all', array('fields' => array('id', 'rss_reader_id', 'title', 'summary', 'link', 'last_updated', 'serialize_value'), 'recursive' => -1, 'conditions' => array('rss_reader_id' => $rssReaderId)));
     $result = Hash::combine($result, '{n}.RssReaderItem.id', '{n}.RssReaderItem');
     $result = Hash::remove($result, '{n}.id');
     $this->_assertArray(null, $expected['RssReaderItem'], array_values($result));
 }
开发者ID:Onasusweb,项目名称:RssReaders,代码行数:32,代码来源:RssReaderItemUpdateRssReaderItemsTest.php

示例7: createMailSettingFixedPhrase

 /**
  * メール設定-定型文 データ新規作成
  *
  * @param int $languageId 言語ID
  * @param string $typeKey メール定型文の種類
  * @param string $pluginKey プラグインキー
  * @return array メール設定データ配列
  */
 public function createMailSettingFixedPhrase($languageId = null, $typeKey = self::DEFAULT_TYPE, $pluginKey = null)
 {
     if ($languageId === null) {
         $languageId = Current::read('Language.id');
     }
     if ($pluginKey === null) {
         $pluginKey = Current::read('Plugin.key');
     }
     //デフォルトデータ取得
     $conditions = array('language_id' => $languageId, 'plugin_key' => $pluginKey, 'block_key' => null, 'type_key' => $typeKey);
     $mailFixedPhrase = $this->getMailSettingFixedPhrase($conditions);
     if ($mailFixedPhrase) {
         $mailFixedPhrase = Hash::remove($mailFixedPhrase, '{s}.id');
     } else {
         $mailFixedPhrase = $this->create();
         $mailFixedPhrase[$this->alias]['type_key'] = $typeKey;
     }
     //初期データセット
     $this->__noSetData('mail_fixed_phrase_subject', $mailFixedPhrase, $typeKey);
     $this->__noSetData('mail_fixed_phrase_body', $mailFixedPhrase, $typeKey);
     $mailFixedPhrase = Hash::remove($mailFixedPhrase, '{s}.created');
     $mailFixedPhrase = Hash::remove($mailFixedPhrase, '{s}.created_user');
     $mailFixedPhrase = Hash::remove($mailFixedPhrase, '{s}.modified');
     $mailFixedPhrase = Hash::remove($mailFixedPhrase, '{s}.modified_user');
     return $mailFixedPhrase;
 }
开发者ID:NetCommons3,项目名称:Mails,代码行数:34,代码来源:MailSettingFixedPhrase.php

示例8: delete

 /**
  * @param $name
  * @return bool
  */
 public function delete($name)
 {
     if (self::check($name)) {
         self::_overwrite($this->data, Hash::remove($this->data, $name));
         return !self::check($name);
     }
     return false;
 }
开发者ID:kameshwariv,项目名称:testexample,代码行数:12,代码来源:SessionStub.php

示例9: setState

 public function setState($key, $value, $defaultValue = null)
 {
     $current = isset($_SESSION[$this->sessionVariable]) ? $_SESSION[$this->sessionVariable] : array();
     if ($value === $defaultValue) {
         $_SESSION[$this->sessionVariable] = Hash::remove($current, $key);
     } else {
         $_SESSION[$this->sessionVariable] = Hash::insert($current, $key, $value);
     }
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:9,代码来源:LSWebUser.php

示例10: setStatusOnBasic

 /**
  * システム管理者以外は、選択肢からシステム管理者を除外
  *
  * @param array $user ユーザデータ
  * @return void
  */
 public function setStatusOnBasic($user)
 {
     $controller = $this->controller;
     //状態の選択肢から承認待ち、承認済みを除外
     if (Hash::get($user, 'User.status') !== UserAttributeChoice::STATUS_CODE_WAITING) {
         $controller->viewVars['userAttributes'] = Hash::remove($controller->viewVars['userAttributes'], '{n}.{n}.{n}.UserAttributeChoice.{n}[key=' . UserAttributeChoice::STATUS_KEY_WAITING . ']');
     }
     if (Hash::get($user, 'User.status') !== UserAttributeChoice::STATUS_CODE_APPROVED) {
         $controller->viewVars['userAttributes'] = Hash::remove($controller->viewVars['userAttributes'], '{n}.{n}.{n}.UserAttributeChoice.{n}[key=' . UserAttributeChoice::STATUS_KEY_APPROVED . ']');
     }
 }
开发者ID:NetCommons3,项目名称:UserManager,代码行数:17,代码来源:UserManagerComponent.php

示例11: testAnotherRoomId

 /**
  * Expect empty by another roomId
  *
  * @return void
  */
 public function testAnotherRoomId()
 {
     //データ生成
     $blockId = '100';
     $roomId = '2';
     //処理実行
     $result = $this->Faq->getFaq($blockId, $roomId);
     $result = Hash::remove($result, 'Block');
     //期待値の生成
     $expected = array();
     //テスト実施
     $this->_assertArray($expected, $result);
 }
开发者ID:Onasusweb,项目名称:Faqs,代码行数:18,代码来源:FaqGetFaqTest.php

示例12: _assertArray

 /**
  * _assertArray method
  *
  * @param array $expected expected data
  * @param array $result result data
  * @return void
  */
 protected function _assertArray($expected, $result)
 {
     $result = Hash::remove($result, 'created');
     $result = Hash::remove($result, 'created_user');
     $result = Hash::remove($result, 'modified');
     $result = Hash::remove($result, 'modified_user');
     $result = Hash::remove($result, '{s}.created');
     $result = Hash::remove($result, '{s}.created_user');
     $result = Hash::remove($result, '{s}.modified');
     $result = Hash::remove($result, '{s}.modified_user');
     $result = Hash::remove($result, 'TrackableCreator');
     $result = Hash::remove($result, 'TrackableUpdater');
     $this->assertEquals($expected, $result);
 }
开发者ID:Onasusweb,项目名称:Iframes,代码行数:21,代码来源:IframesModelTestBase.php

示例13: _setupSaveData

 /**
  * _setupSaveData 保存データを整える
  *
  * @param array $data アンケートデータ
  * @param int $status 編集ステータス
  * @return void
  */
 protected function _setupSaveData($data, $status)
 {
     $data = Hash::remove($data, 'id');
     $data = Hash::remove($data, 'modified_user');
     $data = Hash::remove($data, 'modified');
     $data = Hash::remove($data, 'QuestionnaireQuestion');
     $data = Hash::remove($data, 'QuestionnaireChoice');
     $data['status'] = $status;
     // == NetCommonsBlockComponent::STATUS_PUBLISHED ? true : false;
     if (!isset($data['origin_id']) || $data['origin_id'] == '') {
         $data['origin_id'] = '0';
     }
     $data['is_active'] = false;
     $data['is_latest'] = false;
     $data['language_id'] = 0;
     return $data;
 }
开发者ID:Onasusweb,项目名称:Questionnaires,代码行数:24,代码来源:QuestionnairesAppModel.php

示例14: edit

 /**
  * edit
  *
  * @param string $roleKey user_roles.key
  * @return void
  */
 public function edit($roleKey = null)
 {
     if ($this->request->is('put')) {
         if (!Hash::get($this->request->data, 'UserAttributesRole')) {
             return $this->throwBadRequest();
         }
         //不要パラメータ除去
         unset($this->request->data['save']);
         //リクエストの整形
         $ids = array_keys($this->request->data['UserAttributesRole']);
         foreach ($ids as $id) {
             $otherRole = Hash::get($this->request->data, 'UserAttributesRole.' . $id . '.UserAttributesRole.other_user_attribute_role', false);
             if ($otherRole === false) {
                 $this->request->data = Hash::remove($this->request->data, 'UserAttributesRole.' . $id);
                 continue;
             }
             if (!in_array($otherRole, [self::OTHER_READABLE, self::OTHER_NOT_READABLE], true)) {
                 return $this->throwBadRequest();
             }
             $this->request->data['UserAttributesRole'][$id]['UserAttributesRole']['other_readable'] = false;
             $this->request->data['UserAttributesRole'][$id]['UserAttributesRole']['other_editable'] = false;
             if ($otherRole === self::OTHER_READABLE) {
                 $this->request->data['UserAttributesRole'][$id]['UserAttributesRole']['other_readable'] = true;
             }
         }
         //登録処理
         if ($this->UserAttributesRole->saveUserAttributesRoles($this->request->data)) {
             //正常の場合
             $this->NetCommons->setFlashNotification(__d('net_commons', 'Successfully saved.'), array('class' => 'success'));
             $this->redirect('/user_roles/user_roles/index/');
         } else {
             $this->NetCommons->handleValidationError($this->UserAttributesRole->validationErrors);
             $this->redirect('/user_roles/user_attributes_roles/edit/' . h($roleKey));
         }
     } else {
         //既存データ取得
         $this->request->data = $this->UserRoleSetting->getUserRoleSetting(Plugin::PLUGIN_TYPE_FOR_SITE_MANAGER, $roleKey);
         $this->request->data['UserAttributesRole'] = $this->UserAttributesRole->getUserAttributesRole($roleKey);
         $this->request->data['UserAttribute'] = $this->viewVars['userAttributes'];
         $userRole = $this->UserRole->find('first', array('recursive' => -1, 'conditions' => array('key' => $roleKey, 'language_id' => Current::read('Language.id'))));
         $this->request->data = Hash::merge($userRole, $this->request->data);
         $this->set('roleKey', $roleKey);
         $this->set('subtitle', $this->request->data['UserRole']['name']);
     }
 }
开发者ID:NetCommons3,项目名称:UserRoles,代码行数:51,代码来源:UserAttributesRolesController.php

示例15: displayDeleteForm

 /**
  * ブロック削除のForm出力
  *
  * @param array $options オプション
  * - `model` モデル名
  * - `callback` コールバックするelement
  * - `callbackOptions` コールバックのオプション
  * - `url` 削除アクション(省略可)
  * - `options` Form->create()のオプション
  * @return string HTML
  */
 public function displayDeleteForm($options = array())
 {
     $html = '';
     if ($this->_View->request->params['action'] === 'edit') {
         if (Hash::get($options, 'url')) {
             $options['options']['url'] = Hash::get($options, 'url');
             $options = Hash::remove($options, 'url');
         }
         if (!Hash::get($options, 'options.url')) {
             $options['options']['url'] = NetCommonsUrl::actionUrl(array('controller' => $this->_View->request->params['controller'], 'action' => 'delete', 'block_id' => Current::read('Block.id'), 'frame_id' => Current::read('Frame.id')));
         }
         if (!Hash::get($options, 'model')) {
             $options['model'] = 'BlockDelete';
         }
         $html .= $this->_View->element('Blocks.delete_form', $options);
     }
     return $html;
 }
开发者ID:akagane99,项目名称:Blocks,代码行数:29,代码来源:BlockFormHelper.php


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