本文整理汇总了PHP中ClassRegistry类的典型用法代码示例。如果您正苦于以下问题:PHP ClassRegistry类的具体用法?PHP ClassRegistry怎么用?PHP ClassRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ClassRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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;
}
示例2: setUp
public function setUp()
{
parent::setUp();
$this->DirectMessage = ClassRegistry::init('Twim.TwimDirectMessage');
$this->DirectMessage->setDataSource('twitter');
$this->TwimSource = $this->DirectMessage->getDataSource();
}
示例3: tearDown
/**
* End a test
*
* @return void
*/
public function tearDown()
{
parent::tearDown();
unset($this->Article);
ClassRegistry::flush();
DebugKitDebugger::clearTimers();
}
示例4: 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;
}
示例5: 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;
}
示例6: __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;
}
示例7: 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;
}
示例8: responsePreprocess
function responsePreprocess()
{
$ipn = ClassRegistry::init("PaypalIpn.InstantPaymentNotification");
if ($ipn->isValid($_POST)) {
$notification = $ipn->buildAssociationsFromIPN($_POST);
$ipn->saveAll($notification);
if ($_POST["payment_status"] == "Completed") {
if (isset($_POST['test_ipn'])) {
$this->payment['ShopPayment']['dev_mode'] = 1;
$data = array('id' => $this->payment['ShopPayment']['id'], 'dev_mode' => $this->payment['ShopPayment']['dev_mode']);
$this->ShopPayment->create();
$this->ShopPayment->save($data);
}
$this->PaymentFunct->setStatus($this->payment, "approved");
} else {
$this->log('Incomplete payment', LOG_DEBUG);
}
/*$conf = Configure::read('Shop.emailAdmin');
$this->Email->to = $conf['to'];
$this->Email->subject = "test module paypal";
$this->Email->sendAs = 'html';
$this->Email->template = 'shop_test';
$this->set('payment', $this->payment);
if(!$this->Email->send()){
Debugger::log('response email not sent');
}else{
Debugger::log('response email sent');
}*/
} else {
$this->log('Invalide Paypal IPN response', LOG_DEBUG);
$this->log($_POST, LOG_DEBUG);
}
}
示例9: setUp
/**
* SetUp method
*
* @return void
*/
public function setUp()
{
parent::setUp();
Configure::write('Config.language', 'deu');
Configure::delete('Passwordable');
Configure::write('Passwordable.auth', 'AuthTest');
$this->User = ClassRegistry::init('Tools.ToolsUser');
if (isset($this->User->validate['pwd'])) {
unset($this->User->validate['pwd']);
}
if (isset($this->User->validate['pwd_repeat'])) {
unset($this->User->validate['pwd_repeat']);
}
if (isset($this->User->validate['pwd_current'])) {
unset($this->User->validate['pwd_current']);
}
if (isset($this->User->order)) {
unset($this->User->order);
}
$this->User->create();
$data = ['id' => '5', 'name' => 'admin', 'password' => Security::hash('somepwd', null, true), 'role_id' => '1'];
$this->User->set($data);
$result = $this->User->save();
$this->assertTrue((bool) $result);
Router::setRequestInfo(new CakeRequest(null, false));
}
示例10: __construct
public function __construct(View $view, $settings = array())
{
parent::__construct($view, $settings);
foreach ($this->uses as $model) {
$this->{$model} = ClassRegistry::init($model);
}
}
示例11: tearDown
/**
* Tear Down
*
* @author Everton Yoshitani <everton@wizehive.com>
* @since 1.0
* @return void
*/
public function tearDown()
{
parent::tearDown();
unset($this->ApiBehavior);
unset($this->Thing);
ClassRegistry::flush();
}
示例12: setUp
public function setUp()
{
parent::setUp();
$this->Model = ClassRegistry::init('TestImap');
$config = [];
$this->Imap = new TestImapSource($config);
}
示例13: __prepare
/**
* Return readable fields
*
* @param Model $model Model using this behavior
* @return void
*/
private function __prepare(Model $model)
{
$this->UserAttribute = ClassRegistry::init('UserAttributes.UserAttribute');
$this->UserAttributesRole = ClassRegistry::init('UserRoles.UserAttributesRole');
if (!isset($this->__readableFields)) {
$results = $this->UserAttributesRole->find('list', array('recursive' => -1, 'fields' => array('user_attribute_key', 'user_attribute_key'), 'conditions' => array('role_key' => AuthComponent::user('role_key'), 'other_readable' => true)));
$this->__readableFields = array('id');
foreach ($results as $key => $field) {
//Fieldのチェック
if ($model->hasField($field)) {
$this->__readableFields[$key] = $model->escapeField($field);
}
if ($model->UsersLanguage->hasField($field)) {
$this->__readableFields[$key] = $model->UsersLanguage->escapeField($field);
}
//Field(is_xxxx_public)のチェック
$fieldKey = sprintf(UserAttribute::PUBLIC_FIELD_FORMAT, $field);
if ($model->hasField($fieldKey)) {
$this->__readableFields[$fieldKey] = $model->escapeField($fieldKey);
}
//Field(xxxx_file_id)のチェック
$fieldKey = sprintf(UserAttribute::FILE_FIELD_FORMAT, $field);
if ($model->hasField($fieldKey)) {
$this->__readableFields[$fieldKey] = $model->escapeField($fieldKey);
}
}
}
}
示例14: startup
/**
* Called after the Controller::beforeFilter() and before the controller action
*
* @param Controller $controller Controller with components to startup
* @return void
* @link http://book.cakephp.org/2.0/en/controllers/components.html#Component::startup
*/
public function startup(Controller $controller)
{
//RequestActionの場合、スキップする
if (!empty($controller->request->params['requested'])) {
return;
}
$this->controller = $controller;
//Modelの呼び出し
$this->Plugin = ClassRegistry::init('PluginManager.Plugin');
//Pluginデータ取得
$this->plugins = $this->Plugin->getPlugins(Plugin::PLUGIN_TYPE_FOR_CONTROL_PANEL, $this->controller->viewVars['languageId']);
//Layoutのセット
$this->controller->layout = 'ControlPanel.default';
//cancelUrlをセット
$this->controller->set('cancelUrl', '/');
$this->controller->set('isControlPanel', true);
$this->controller->set('hasControlPanel', true);
//ページHelperにセット
$this->controller->set('pluginsMenu', $this->plugins);
if (isset($this->settings['plugin'])) {
$plugin = $this->settings['plugin'];
} else {
$plugin = $this->controller->params['plugin'];
}
$plugin = Hash::extract($this->plugins, '{n}.Plugin[key=' . $plugin . ']');
if (isset($plugin[0]['name']) && !isset($this->controller->viewVars['title'])) {
$this->controller->set('title', $plugin[0]['name']);
}
}
示例15: tearDown
/**
* tearDown method
*
* @return void
*/
public function tearDown()
{
unset($this->Task);
ClassRegistry::flush();
App::build();
parent::tearDown();
}