本文整理汇总了PHP中eve函数的典型用法代码示例。如果您正苦于以下问题:PHP eve函数的具体用法?PHP eve怎么用?PHP eve使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eve函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testProcess
public function testProcess()
{
$now = explode(" ", microtime());
$model = eve()->model('auth')->create()->process(array('auth_slug' => 'TEST AUTH ' + $now[1], 'auth_permissions' => 'test_permissions_1,test_permissions_2', 'auth_password' => '123456', 'confirm' => '123456'));
$this->assertTrue(is_numeric($model['auth_id']));
eve()->registry()->set('test', 'auth', $model->get());
}
开发者ID:Eve-PHP,项目名称:Shade,代码行数:7,代码来源:Create.php
示例2: run
/**
* Executes the job
*
* @return void
*/
public function run()
{
//if no data
if (empty($this->data)) {
//there should be a global catch somewhere
throw new Exception(self::FAIL_406);
}
//this will be returned at the end
$results = array();
//see if the email exists first
$exists = eve()->model('auth')->exists($this->data['profile_email']);
//if it does
if ($exists) {
//not sure, throw an error ?
throw new Exception('Email exists.');
}
//find the profile by email
$row = eve()->model('profile')->search()->process()->filterByProfileEmail($this->data['profile_email'])->getRow();
//if no profile
if (empty($row)) {
//create one
$row = eve()->model('profile')->create()->process($this->data)->get();
}
//store the profile
$results['profile'] = $row;
//create the auth
$results['auth'] = eve()->model('auth')->create()->process($this->data)->get();
//link profile
eve()->model('auth')->linkProfile($results['auth']['auth_id'], $results['profile']['profile_id']);
return $results;
}
开发者ID:Eve-PHP,项目名称:Shade,代码行数:36,代码来源:Create.php
示例3: import
/**
* Main route method
*
* @return function
*/
public function import(array $l10n = array())
{
//remember this scope
$self = $this;
//You can add validators here
return function ($request, $response) use($self, $l10n) {
//before we do anything, lets's check for l10n and i18n
$host = $request->get('server', 'HTTP_HOST');
//if we can't find the host
if (!isset($l10n[$host]) || $l10n[$host] === 'default') {
//just use the default settings
$host = 'default';
}
//if it's a redirect
if (is_string($l10n[$host])) {
eve()->redirect('http://' . $l10n[$host]);
}
//load the languages
foreach ($l10n[$host]['i18n'] as $i => $i18n) {
$translations = eve()->settings('i18n/' . $i18n);
if ($i === 0) {
eve()->defaultLanguage = eve('language', $translations);
}
$request->set('i18n', $i18n, $translations);
}
//set the locale
$request->set('l10n', $l10n[$host]);
};
}
开发者ID:eve-php,项目名称:eve-plugin-l10n,代码行数:34,代码来源:Setup.php
示例4: testRender
public function testRender()
{
$app = eve()->registry()->get('test', 'app');
$_GET = array('client_id' => $app['app_token'], 'redirect_uri' => '/control/app/search');
$results = BrowserTest::i()->setPath('/dialog/action/login')->setGet($_GET)->setQueryString($_GET)->setIsTriggered(true)->process();
$this->assertTrue($results['triggered']);
}
开发者ID:Eve-PHP,项目名称:Shade,代码行数:7,代码来源:Login.php
示例5: testUnlinkProfile
public function testUnlinkProfile()
{
$auth = eve()->registry()->get('test', 'auth');
$model = eve()->model('auth')->unlinkProfile($auth['auth_id'], 400);
$this->assertEquals($auth['auth_id'], $model['auth_profile_auth']);
$this->assertEquals(400, $model['auth_profile_profile']);
}
开发者ID:Eve-PHP,项目名称:Shade,代码行数:7,代码来源:Index.php
示例6: testImport
public function testImport()
{
$callback = Eve\Plugin\Csrf\Setup::i()->import();
$this->assertTrue(is_callable($callback));
$error = false;
try {
eve()->addCsrf(eden('registry'), eden('registry'), array('method' => 'GET', 'check_csrf' => true));
} catch (Exception $e) {
$error = true;
}
$this->assertTrue($error);
$error = false;
$request = eden('registry')->set('get', 'csrf', '1234567890');
try {
eve()->addCsrf($request, eden('registry'), array('method' => 'GET', 'check_csrf' => true, 'make_csrf' => true));
} catch (Exception $e) {
$error = true;
}
$this->assertFalse($error);
$this->assertTrue($request->get('get', 'csrf') !== $request->get('csrf'));
$_GET['csrf'] = $_SESSION['csrf'] = $request->get('csrf');
$error = false;
try {
$callback($request, eden('registry'));
} catch (Exception $e) {
$error = true;
}
$this->assertFalse($error);
}
开发者ID:eve-php,项目名称:eve-plugin-csrf,代码行数:29,代码来源:Setup.php
示例7: testRender
public function testRender()
{
$app = eve()->registry()->get('test', 'app');
$_GET = array('access_token' => $app['app_token']);
$results = BrowserTest::i()->setPath('/rest/action/profile/search')->setGet($_GET)->setSource($_GET)->setIsTriggered(false)->process();
$this->assertContains('"error": false', $results['data']);
}
开发者ID:Eve-PHP,项目名称:Shade,代码行数:7,代码来源:Search.php
示例8: testProcess
public function testProcess()
{
$auth = eve()->registry()->get('test', 'auth');
$profile = eve()->registry()->get('test', 'profile');
$row = eve()->model('session')->login()->process(array('auth_slug' => $auth['auth_slug'], 'auth_password' => '123456'));
$this->assertEquals($profile['profile_name'], $row['profile_name']);
}
开发者ID:Eve-PHP,项目名称:Shade,代码行数:7,代码来源:Login.php
示例9: testProcess
public function testProcess()
{
$now = explode(" ", microtime());
$auth = eve()->registry()->get('test', 'auth');
$model = eve()->model('auth')->update()->process(array('auth_id' => $auth['auth_id'], 'auth_slug' => 'TEST AUTH ' + $now[1], 'auth_permissions' => 'test_permissions_1,test_permissions_2', 'auth_password' => '123456', 'confirm' => '123456'));
$this->assertEquals('test_permissions_1,test_permissions_2', $model['auth_permissions']);
}
开发者ID:Eve-PHP,项目名称:Shade,代码行数:7,代码来源:Update.php
示例10: testGetAppByToken
public function testGetAppByToken()
{
$session = eve()->registry()->get('test', 'session');
$app = eve()->registry()->get('test', 'app');
$row = eve()->model('session')->getAppByToken($session['access_token']);
$this->assertEquals($app['app_id'], $row['app_id']);
}
开发者ID:Eve-PHP,项目名称:Shade,代码行数:7,代码来源:Index.php
示例11: testProcess
public function testProcess()
{
$rows = eve()->model('profile')->search()->process()->getRows();
foreach ($rows as $row) {
$this->assertEquals(1, $row['profile_active']);
}
}
开发者ID:Eve-PHP,项目名称:Shade,代码行数:7,代码来源:Search.php
示例12: testValid
public function testValid()
{
$data = array('app_name' => 'Test Action App Updated', 'app_domain' => '*.test.com', 'app_permissions' => 'public_sso,user_profile,global_profile', 'profile_id' => $_SESSION['me']['profile_id']);
$app = eve()->registry()->get('test', 'app');
$variables = array($app['app_id']);
$results = BrowserTest::i()->setPath('/back/action/app/update')->setPost($data)->setVariables($variables)->setIsValid(true)->setIsTriggered(true)->process();
$this->assertTrue($results['triggered']);
}
开发者ID:Eve-PHP,项目名称:Shade,代码行数:8,代码来源:Update.php
示例13: testProcess
public function testProcess()
{
$auth = eve()->registry()->get('test', 'auth');
$app = eve()->registry()->get('test', 'app');
$config = eve()->settings('test');
$model = eve()->model('session')->request()->process(array('app_id' => $app['app_id'], 'auth_id' => $auth['auth_id'], 'session_permissions' => implode(',', $config['scope'])));
$this->assertTrue(is_string($model['session_token']));
eve()->registry()->set('test', 'session', $model->get());
}
开发者ID:Eve-PHP,项目名称:Shade,代码行数:9,代码来源:Request.php
示例14: testRender
public function testRender()
{
$app = eve()->registry()->get('test', 'app');
$_GET = array('access_token' => $app['app_token'], 'access_secret' => $app['app_secret']);
$_POST = array('profile_name' => 'Profile updated by REST');
$source = array('profile_id' => 1);
$results = BrowserTest::i()->setPath('/rest/action/profile/update')->setPost($_POST)->setSource($source)->setIsTriggered(false)->process();
$this->assertContains('"error": false', $results['data']);
}
开发者ID:Eve-PHP,项目名称:Shade,代码行数:9,代码来源:Update.php
示例15: testValid
public function testValid()
{
$app = eve()->registry()->get('test', 'app');
$_GET = array('client_id' => $app['app_token'], 'redirect_uri' => '/control/app/search');
$_POST = array('profile_name' => 'Test Dialog Action Create', 'profile_email' => '[email protected]', 'auth_permissions' => 'user_profile,personal_profile,global_profile', 'auth_password' => '123', 'confirm' => '123');
$app = eve()->registry()->get('test', 'app');
$results = BrowserTest::i()->setPath('/dialog/action/update')->setGet($_GET)->setPost($_POST)->setSource($app)->setQueryString($_POST)->setIsValid(true)->setIsTriggered(true)->process();
$this->assertTrue($results['triggered']);
}
开发者ID:Eve-PHP,项目名称:Shade,代码行数:9,代码来源:Update.php
示例16: testRender
public function testRender()
{
$app = eve()->registry()->get('test', 'app');
$session = eve()->registry()->get('test', 'session');
$_GET = array('access_token' => $app['app_token'], 'access_secret' => $app['app_secret']);
$_POST = array('code' => $session['session_token']);
$results = BrowserTest::i()->setPath('/rest/action/access')->setMethod($_GET)->setPost($_POST)->setSource($_GET)->setIsTriggered(false)->process();
$this->assertContains('"error": false', $results['data']);
}
开发者ID:Eve-PHP,项目名称:Shade,代码行数:9,代码来源:Access.php
示例17: render
/**
* Main action call
*
* @return string|null|void
*/
public function render()
{
$data = $this->request->get('get');
$data['range'] = $this->range;
//get rows
$rows = eve()->model('profile')->search()->process($data)->setColumns('profile_id', 'profile_name', 'profile_image', 'profile_created')->getRows();
//success
$this->success($rows);
}
开发者ID:Eve-PHP,项目名称:Shade,代码行数:14,代码来源:Search.php
示例18: run
/**
* Executes the job
*
* @return void
*/
public function run()
{
//if no data
if (empty($this->data)) {
//there should be a global catch somewhere
throw new Exception(self::FAIL_406);
}
$results['session'] = eve()->model('session')->request()->process($this->data)->get();
return $results;
}
开发者ID:Eve-PHP,项目名称:Shade,代码行数:15,代码来源:Request.php
示例19: testProcess
public function testProcess()
{
$config = eve()->settings('test');
$profile = eve()->registry()->get('test', 'profile');
$session = eve()->registry()->get('test', 'session');
$model = eve()->model('session')->access()->process(array('client_id' => $config['app_token'], 'client_secret' => $config['app_secret'], 'code' => $session['session_token']));
$this->assertTrue(is_string($model['access_token']));
$this->assertTrue(is_string($model['access_secret']));
$this->assertEquals($profile['profile_name'], $model['profile_name']);
eve()->registry()->set('test', 'session', $model);
}
开发者ID:Eve-PHP,项目名称:Shade,代码行数:11,代码来源:Access.php
示例20: testProcess
public function testProcess()
{
$model = eve()->model('profile')->create()->process(array('profile_name' => 'Automated Test', 'profile_email' => '[email protected]'));
$this->assertTrue(is_numeric($model['profile_id']));
eve()->registry()->set('test', 'set', $model->get());
$set = eve()->registry()->get('test', 'set');
$model = eve()->model('profile')->update()->process(array('profile_id' => $set['profile_id'], 'profile_name' => 'Automated Test', 'profile_email' => '[email protected]'));
$this->assertEquals($set['profile_id'], $model['profile_id']);
$model = eve()->model('profile')->set()->process(array('profile_id' => $set['profile_id'], 'profile_name' => 'Automated Test', 'profile_email' => '[email protected]'));
$this->assertEquals($set['profile_id'], $model['profile_id']);
$this->assertEquals('[email protected]', $model['profile_email']);
}
开发者ID:Eve-PHP,项目名称:Shade,代码行数:12,代码来源:Set.php
注:本文中的eve函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论