本文整理汇总了PHP中Croogo::hookApiComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP Croogo::hookApiComponent方法的具体用法?PHP Croogo::hookApiComponent怎么用?PHP Croogo::hookApiComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Croogo
的用法示例。
在下文中一共展示了Croogo::hookApiComponent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testHookApiComponent
/**
* test Croogo::hookApiComponent
*/
public function testHookApiComponent()
{
$hooks = Configure::read('Hook.controller_properties');
Configure::write('Hook.controller_properties', array());
Croogo::hookApiComponent('Example', 'Example.ExampleApi');
Croogo::hookApiComponent('Example', array('Users.UserApi' => array('priority' => 2)));
$expected = array('Example' => array('_apiComponents' => array('Example.ExampleApi' => array('priority' => 8), 'Users.UserApi' => array('priority' => 2))));
$result = Configure::read('Hook.controller_properties');
$this->assertEquals($expected, $result);
Configure::write('Hook.controller_properties', $hooks);
}
示例2: testSetupComponent
/**
* Test Setup Component
*/
public function testSetupComponent()
{
$request = new CakeRequest('/api/v1.0/users');
$request->addParams(array('api' => 'api', 'prefix' => 'v1.0'));
$controller = new TestAppController($request);
$defaultComponents = $controller->components;
$this->assertEmpty($controller->_apiComponents);
$key = 'Hook.controller_properties.TestApp._apiComponents';
Configure::write($key, array('BogusApi'));
Croogo::hookApiComponent('TestApp', 'Example.ImaginaryApi');
$expected = array('BogusApi' => array('className' => 'BogusApi', 'priority' => 8), 'ImaginaryApi' => array('className' => 'Example.ImaginaryApi', 'priority' => 8));
$controller = new TestAppController($request);
$this->assertEquals($expected, $controller->_apiComponents);
$merged = Hash::merge($defaultComponents, array('BogusApi'), array('Example.ImaginaryApi' => array('priority' => 8)));
$this->assertEquals($merged, $controller->components);
Configure::delete('Hook.controller_properties.TestApp');
}
示例3: array
<?php
Croogo::hookApiComponent('Users', 'Users.UserApi');
/**
* Failed login attempts
*
* Default is 5 failed login attempts in every 5 minutes
*/
$cacheConfig = array_merge(Configure::read('Cache.defaultConfig'), array('groups' => array('users')));
$failedLoginDuration = 300;
Configure::write('User.failed_login_limit', 5);
Configure::write('User.failed_login_duration', $failedLoginDuration);
CroogoCache::config('users_login', array_merge($cacheConfig, array('duration' => '+' . $failedLoginDuration . ' seconds', 'groups' => array('users'))));
Croogo::hookAdminRowAction('Users/admin_index', 'Reset Password', array('admin:true/plugin:users/controller:users/action:reset_password/:id' => array('title' => false, 'options' => array('icon' => 'unlock', 'tooltip' => array('data-title' => __d('croogo', 'Reset password'))))));
示例4: array_merge
<?php
$cacheConfig = array_merge(Configure::read('Cache.defaultConfig'), array('groups' => array('nodes')));
CroogoCache::config('nodes', $cacheConfig);
CroogoCache::config('nodes_view', $cacheConfig);
CroogoCache::config('nodes_promoted', $cacheConfig);
CroogoCache::config('nodes_term', $cacheConfig);
CroogoCache::config('nodes_index', $cacheConfig);
Croogo::hookApiComponent('Nodes', 'Nodes.NodeApi');
Croogo::hookComponent('*', 'Nodes.Nodes');
Croogo::hookHelper('*', 'Nodes.Nodes');
// Configure Wysiwyg
Croogo::mergeConfig('Wysiwyg.actions', array('Nodes/admin_add' => array(array('elements' => 'NodeBody')), 'Nodes/admin_edit' => array(array('elements' => 'NodeBody')), 'Translate/admin_edit' => array(array('elements' => 'NodeBody'))));
Croogo::mergeConfig('Translate.models.Node', array('fields' => array('title' => 'titleTranslation', 'excerpt' => 'excerptTranslation', 'body' => 'bodyTranslation'), 'translateModel' => 'Nodes.Node'));