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


PHP ClassRegistry::init方法代码示例

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


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

示例1: up

 /**
  * up
  *
  * @access public
  * @return boolean
  */
 public function up()
 {
     if (!is_writable(CONFIGS)) {
         $this->errors[] = sprintf(__('Cannot write to the configuration directory. Please change the permission on %s so that it is writable.', true), CONFIGS);
         return false;
     }
     if (!file_exists(CONFIGS . 'guard.php')) {
         if (!copy(APP . DS . 'plugins' . DS . 'guard' . DS . 'config' . DS . 'guard.php', CONFIGS . 'guard.php')) {
             $this->errors[] = __('Cannot copy the guard configuration (app/plugins/guard/config/guard.php) to the configuration directory.', true);
             return false;
         }
     }
     // when upgrading from v2, will run through all the delta_*.sql files
     // up to $this->dbVersion because the database version wasn't stored in
     // the database, so PHP get a null value back, which is then treated
     // as if we're starting from version 0
     $sysparameter = ClassRegistry::init('SysParameter');
     $dbv = $sysparameter->getDatabaseVersion();
     $ret = $this->patchDb($dbv, $this->dbVersion);
     if ($ret) {
         $this->errors[] = sprintf(__('Database patching failed: %s', true), $ret);
         return false;
     }
     $sysparameter->reload();
     if (!file_exists(TMP . 'installed.txt')) {
         $f = fopen(TMP . 'installed.txt', 'w');
         if (!$f) {
             $this->errors[] = sprintf(__('Installation failed, unable to write to %s dir', true), CONFIGS);
             return false;
         }
         fclose($f);
     }
     return true;
 }
开发者ID:eecian,项目名称:Team08-iPeer,代码行数:40,代码来源:upgrade_300.php

示例2: getRolesRoomsUsers

 /**
  * Return roles_rooms_users
  *
  * @param array $conditions Conditions by Model::find
  * @return array
  */
 public function getRolesRoomsUsers($conditions = array())
 {
     $this->Room = ClassRegistry::init('Rooms.Room');
     $conditions = Hash::merge(array('Room.page_id_top NOT' => null), $conditions);
     $rolesRoomsUsers = $this->find('all', array('recursive' => -1, 'fields' => array($this->alias . '.*', $this->RolesRoom->alias . '.*', $this->Room->alias . '.*'), 'joins' => array(array('table' => $this->RolesRoom->table, 'alias' => $this->RolesRoom->alias, 'type' => 'INNER', 'conditions' => array($this->alias . '.roles_room_id' . ' = ' . $this->RolesRoom->alias . ' .id')), array('table' => $this->Room->table, 'alias' => $this->Room->alias, 'type' => 'INNER', 'conditions' => array($this->RolesRoom->alias . '.room_id' . ' = ' . $this->Room->alias . ' .id'))), 'conditions' => $conditions));
     return $rolesRoomsUsers;
 }
开发者ID:Onasusweb,项目名称:Rooms,代码行数:13,代码来源:RolesRoomsUser.php

示例3: setUp

 public function setUp()
 {
     parent::setUp();
     $this->DirectMessage = ClassRegistry::init('Twim.TwimDirectMessage');
     $this->DirectMessage->setDataSource('twitter');
     $this->TwimSource = $this->DirectMessage->getDataSource();
 }
开发者ID:nojimage,项目名称:cakephp-twim,代码行数:7,代码来源:TwimDirectMessageNeedAuthTest.php

示例4: beforeSave

 public function beforeSave($options = array())
 {
     $State = ClassRegistry::init('State');
     //$basketballTeam = new BasketballTeam();
     $state = $State->field('name', array('id' => $this->data['Insurance']['state_id']));
     $this->data['Insurance']['state'] = $state;
 }
开发者ID:abhinav67,项目名称:prodigy2,代码行数:7,代码来源:Insurance.php

示例5: get_twitter_tweets_group_by_types

 public function get_twitter_tweets_group_by_types($types, $order)
 {
     foreach ($types as &$t) {
         $t = array('id' => $t, 'search' => ClassRegistry::init('Dane.Dataobject')->find('all', array('conditions' => array('dataset' => 'twitter', 'twitter_accounts.typ_id' => $t, '!bez_retweetow' => '1', 'czas_utworzenia' => '2013-*'), 'order' => $order, 'limit' => 3)));
     }
     return $types;
 }
开发者ID:slachiewicz,项目名称:_mojePanstwo-API-Server,代码行数:7,代码来源:PanstwoInternet.php

示例6: auth

 /**
  * acl and auth
  *
  * @return void
  */
 public function auth()
 {
     //Configure AuthComponent
     $this->_controller->Auth->authenticate = array(AuthComponent::ALL => array('userModel' => 'User', 'fields' => array('username' => 'username', 'password' => 'password'), 'scope' => array('User.status' => 1)), 'Form');
     $actionPath = 'controllers';
     $this->_controller->Auth->authorize = array(AuthComponent::ALL => array('actionPath' => $actionPath), 'Actions');
     $this->_controller->Auth->loginAction = array('plugin' => null, 'controller' => 'users', 'action' => 'login');
     $this->_controller->Auth->logoutRedirect = array('plugin' => null, 'controller' => 'users', 'action' => 'login');
     $this->_controller->Auth->loginRedirect = array('plugin' => null, 'controller' => 'users', 'action' => 'index');
     if ($this->_controller->Auth->user() && $this->_controller->Auth->user('role_id') == 1) {
         // Role: Admin
         $this->_controller->Auth->allow();
     } else {
         if ($this->_controller->Auth->user()) {
             $roleId = $this->_controller->Auth->user('role_id');
         } else {
             $roleId = 3;
             // Role: Public
         }
         $allowedActions = ClassRegistry::init('Acl.AclPermission')->getAllowedActionsByRoleId($roleId);
         $linkAction = Inflector::camelize($this->_controller->request->params['controller']) . '/' . $this->_controller->request->params['action'];
         if (in_array($linkAction, $allowedActions)) {
             $this->_controller->Auth->allowedActions = array($this->_controller->request->params['action']);
         }
     }
 }
开发者ID:beyondkeysystem,项目名称:testone,代码行数:31,代码来源:AclFilterComponent.php

示例7: __construct

 /**
  * Constructor
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->Permission = ClassRegistry::init(array('class' => 'Permission', 'alias' => 'Permission'));
     $this->Aro = $this->Permission->Aro;
     $this->Aco = $this->Permission->Aco;
 }
开发者ID:slachiewicz,项目名称:_mojePanstwo-API-Server,代码行数:11,代码来源:DbAcl.php

示例8: up

 /**
  * up
  *
  * @access public
  * @return boolean
  */
 public function up()
 {
     $sysparameter = ClassRegistry::init('SysParameter');
     $sysparameter->setValue('system.version', IPEER_VERSION);
     $sysparameter->reload();
     return true;
 }
开发者ID:eecian,项目名称:Team08-iPeer,代码行数:13,代码来源:upgrade_default.php

示例9: _findFeed

 function _findFeed(&$Model, $state, $query, $results = array())
 {
     if ($state == 'before') {
         if (!isset($query['feed'])) {
             return $query;
         }
         $DboMysql = Connectionmanager::getDataSource($Model->useDbConfig);
         $sql = '';
         foreach ((array) $query['feed'] as $key => $feed) {
             $feed = array_merge($this->basicStatement, $feed);
             $sql .= ' UNION ';
             $currentModel = ClassRegistry::init($key);
             $setup = explode(' AND ', str_replace(array('=', '`'), array('AS', '\''), $DboMysql->conditions(array_flip($feed['setup']), false, false)));
             $sql .= $DboMysql->renderStatement('select', array('fields' => implode(', ', array_merge($DboMysql->fields($currentModel, null, (array) $feed['fields']), $setup)), 'table' => $DboMysql->fullTableName($currentModel), 'alias' => $currentModel->alias, 'joins' => '', 'conditions' => $DboMysql->conditions($feed['conditions']), 'group' => '', 'order' => $DboMysql->order($feed['order']), 'limit' => $DboMysql->limit($feed['limit'])));
         }
         $query = array_merge($this->basicStatement, $query);
         $setup = explode(' AND ', str_replace(array('=', '`'), array('AS', '\''), $DboMysql->conditions(array_flip($query['setup']), false, false)));
         $sql = $DboMysql->renderStatement('select', array('fields' => implode(', ', array_merge($DboMysql->fields($Model, null, (array) $query['fields']), $setup)), 'table' => $DboMysql->fullTableName($Model), 'alias' => $Model->alias, 'joins' => '', 'conditions' => $DboMysql->conditions($query['conditions']), 'group' => $sql, 'order' => $DboMysql->order($query['order']), 'limit' => $DboMysql->limit($query['limit'])));
         $_results = $Model->query($sql);
         foreach ($_results as $res) {
             $this->_results[]['Feed'] = $res[0];
         }
         return $query;
     } elseif ($state == 'after') {
         return $this->_results;
     }
     return false;
 }
开发者ID:rchavik,项目名称:infinitas,代码行数:28,代码来源:feedable.php

示例10: startTest

 /**
  * undocumented function
  *
  * @return void
  * @access public
  */
 function startTest()
 {
     $this->Sut = new GiftsController();
     $this->Sut->constructClasses();
     $this->Sut->Component->initialize($this->Sut);
     $this->Sut->beforeFilter();
     $this->Sut->Component->startup($this->Sut);
     $this->Gift = ClassRegistry::init('Gift');
     $this->Contact = ClassRegistry::init('Contact');
     $this->Address = ClassRegistry::init('Address');
     $this->Appeal = ClassRegistry::init('Appeal');
     $this->Office = ClassRegistry::init('Office');
     $this->Country = ClassRegistry::init('Country');
     $this->City = ClassRegistry::init('City');
     $this->Frequency = ClassRegistry::init('Frequency');
     $models = array('Gift', 'Contact', 'Address', 'Phone');
     AppModel::resetRequired($models);
     if (!$this->gpiAppealId) {
         $this->gpiAppealId = $this->Appeal->lookup(array('name LIKE' => '%default GPI appeal%'), 'id', false);
     }
     if (!$this->exampleAppealId) {
         $this->exampleAppealId = $this->Appeal->lookup(array('name LIKE' => '%Example%'), 'id', false);
     }
     if (!$this->belgiumOfficeId) {
         $this->belgiumOfficeId = $this->Office->lookup(array('name LIKE' => '%Belgium%'), 'id', false);
     }
     if (!$this->gpiOfficeId) {
         $this->gpiOfficeId = $this->Office->lookup(array('name LIKE' => '%International%'), 'id', false);
     }
 }
开发者ID:stripthis,项目名称:donate,代码行数:36,代码来源:gifts_controller.test.php

示例11: testExecute

 /**
  * Test task execution
  * 
  * @param array $freeSlots
  * @param array $getPending
  * @param array $processEvents
  * @dataProvider executeProvider
  */
 public function testExecute(array $freeSlots, array $getPending, array $processEvents)
 {
     $tasksCount = count($getPending);
     $slotsCount = count($freeSlots);
     $ProcessManager = $this->getMockBuilder('ProcessManager')->disableAutoload()->setMethods(array('fork'))->getMock();
     $ProcessManager->expects($this->exactly(count($getPending)))->method('fork')->willReturnCallback(function ($callable) {
         $callable();
     });
     $Task = $this->getMockBuilder('TaskServerTask')->setMethods(array('_makeRunner'))->getMock();
     $Task->ProcessManager = $ProcessManager;
     if ($tasksCount > 0) {
         for ($number = 0; $number < $tasksCount; $number++) {
             $Task->expects($this->at($number))->method('_makeRunner')->with($getPending[$number])->willReturnCallback($this->_makeRunner($processEvents));
         }
     } else {
         $Task->expects($this->never())->method('_run');
     }
     $Task->TaskClient = ClassRegistry::init('TaskClient');
     $Task->TaskServer = $this->getMockBuilder('TaskServer')->setConstructorArgs(array(false, null, 'test'))->setMethods(array('freeSlots', 'getPending', 'killZombies'))->getMock();
     $Task->TaskServer->expects($this->at(0))->method('killZombies');
     $at = 1;
     for ($number = 0; $number < $slotsCount; $number++) {
         $Task->TaskServer->expects($this->at($at++))->method('freeSlots')->willReturn($freeSlots[$number]);
         if (isset($getPending[$number])) {
             $Task->TaskServer->expects($this->at($at++))->method('getPending')->willReturn($getPending[$number]);
         }
     }
     Configure::write('Task.processEvents', $processEvents);
     $Task->execute();
     foreach ($processEvents as $processEvent) {
         $this->assertNotEmpty(TaskServerTaskTestEventModel1::$calls[$processEvent['key']]);
         $this->assertCount(count($getPending), TaskServerTaskTestEventModel1::$calls[$processEvent['key']]);
     }
 }
开发者ID:imsamurai,项目名称:cakephp-task-plugin,代码行数:42,代码来源:TaskServerTaskTest.php

示例12: generatePhotoGalleryById

 public function generatePhotoGalleryById($id = null, $optionArray = null)
 {
     if ($id) {
         //default settings
         $caption = true;
         $thumbnailColClass = 'photo-gallery col-xs-4 col-md-3';
         $galleryId = '';
         $galleryTitle = true;
         if ($optionArray) {
             if (isset($optionArray['galleryId']) and !empty($optionArray['galleryId'])) {
                 $galleryId = $optionArray['galleryId'];
             }
             if (isset($optionArray['thumbnailColClass'])) {
                 $thumbnailColClass = $optionArray['thumbnailColClass'];
             }
             if (isset($optionArray['controls'])) {
                 $controls = $optionArray['controls'];
             }
             if (isset($optionArray['caption'])) {
                 $caption = $optionArray['caption'];
             }
             if (isset($optionArray['galleryTitle'])) {
                 $galleryTitle = $optionArray['galleryTitle'];
             }
         }
         $data = ClassRegistry::init('PhotoGallery')->findById($id);
         return $this->photoGallery($data, $galleryId, $caption, $thumbnailColClass, $galleryTitle);
     }
 }
开发者ID:iqbaltiger,项目名称:datasurveyproject-cakephp,代码行数:29,代码来源:GalleryHelper.php

示例13: startTest

 function startTest()
 {
     $this->TwitterGoodies = new TwitterGoodiesHelper();
     $this->TwitterGoodies->Twitter = new TwitterHelper();
     $this->TwitterGoodies->Twitter->Html = new HtmlHelper();
     ClassRegistry::init('View', 'view');
 }
开发者ID:elstc,项目名称:twitter_kit,代码行数:7,代码来源:twitter_goodies.test.php

示例14: testProcessVersion

 /**
  * testProcessVersion
  *
  * @return void
  */
 public function testProcessVersion()
 {
     $this->Image->create();
     $result = $this->Image->save(array('foreign_key' => 'test-1', 'model' => 'Test', 'file' => array('name' => 'titus.jpg', 'size' => 332643, 'tmp_name' => CakePlugin::path('FileStorage') . DS . 'Test' . DS . 'Fixture' . DS . 'File' . DS . 'titus.jpg', 'error' => 0)));
     $result = $this->Image->find('first', array('conditions' => array('id' => $this->Image->getLastInsertId())));
     $this->assertTrue(!empty($result) && is_array($result));
     $this->assertTrue(file_exists($this->testPath . $result['ImageStorage']['path']));
     $path = $this->testPath . $result['ImageStorage']['path'];
     $Folder = new Folder($path);
     $folderResult = $Folder->read();
     $this->assertEqual(count($folderResult[1]), 3);
     Configure::write('Media.imageSizes.Test', array('t200' => array('thumbnail' => array('mode' => 'outbound', 'width' => 200, 'height' => 200))));
     ClassRegistry::init('FileStorage.ImageStorage')->generateHashes();
     $Event = new CakeEvent('ImageVersion.createVersion', $this->Image, array('record' => $result, 'storage' => StorageManager::adapter('Local'), 'operations' => array('t200' => array('thumbnail' => array('mode' => 'outbound', 'width' => 200, 'height' => 200)))));
     CakeEventManager::instance()->dispatch($Event);
     $path = $this->testPath . $result['ImageStorage']['path'];
     $Folder = new Folder($path);
     $folderResult = $Folder->read();
     $this->assertEqual(count($folderResult[1]), 4);
     $Event = new CakeEvent('ImageVersion.removeVersion', $this->Image, array('record' => $result, 'storage' => StorageManager::adapter('Local'), 'operations' => array('t200' => array('thumbnail' => array('mode' => 'outbound', 'width' => 200, 'height' => 200)))));
     CakeEventManager::instance()->dispatch($Event);
     $path = $this->testPath . $result['ImageStorage']['path'];
     $Folder = new Folder($path);
     $folderResult = $Folder->read();
     $this->assertEqual(count($folderResult[1]), 3);
 }
开发者ID:arourke,项目名称:cakephp-file-storage,代码行数:31,代码来源:ImageStorageTest.php

示例15: getBilanServiceWithLoop

 function getBilanServiceWithLoop($id = 'all')
 {
     //  Méthode 2 : à l'aide d'une d'une boucle
     //ToDo
     $this->MatieresPerso =& ClassRegistry::init('MatieresPerso');
     $this->MatieresPerso->recursive = -1;
     if ($id == 'all' or $id == null) {
         $temp = $this->MatieresPerso->find('all');
         //$h = array('h_cours'=>0, 'h_td'=>0, 'h_tp'=>0);
         /*
         foreach ( $temp as $key => $matieresperso  ) {
         	$h['h_cours'] = $h['h_cours'] + $matieresperso['MatieresPerso']['h_cours'];
         	$h['h_td'] = $h['h_td'] + $matieresperso['MatieresPerso']['h_td'];
         	$h['h_tp'] = $h['h_tp'] + $matieresperso['MatieresPerso']['h_tp'];				
         }
         return $result;
         */
         //return $temp;
         // ToDo ToFix
         return "ToDo";
     } else {
         $temp = $this->MatieresPerso->find('all', array('conditions' => array('perso_id' => $id)));
         $h = array('h_cours' => 0, 'h_td' => 0, 'h_tp' => 0);
         foreach ($temp as $key => $matieresperso) {
             $h['h_cours'] = $h['h_cours'] + $matieresperso['MatieresPerso']['h_cours'];
             $h['h_td'] = $h['h_td'] + $matieresperso['MatieresPerso']['h_td'];
             $h['h_tp'] = $h['h_tp'] + $matieresperso['MatieresPerso']['h_tp'];
         }
         return $h;
     }
 }
开发者ID:BackupTheBerlios,项目名称:openphysic-svn,代码行数:31,代码来源:perso.php


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