本文整理汇总了PHP中Assert::false方法的典型用法代码示例。如果您正苦于以下问题:PHP Assert::false方法的具体用法?PHP Assert::false怎么用?PHP Assert::false使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assert
的用法示例。
在下文中一共展示了Assert::false方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin_go
/**
* undocumented function
*
* @return void
* @access public
*/
function admin_go()
{
Assert::false($this->isGet(), '404');
$validTypes = array('gifts', 'transactions', 'users', 'appeals');
$type = $this->data['Search']['resource'];
Assert::true(in_array($type, $validTypes), '404');
$url = array('controller' => $type, 'action' => 'index', 'all', '?' => 'keyword=' . $this->data['Search']['keyword']);
$this->redirect($url);
}
示例2: admin_delete
/**
* undocumented function
*
* @return void
* @access public
*/
function admin_delete($id)
{
$role = $this->Role->findById($id);
Assert::notEmpty($role, '404');
Assert::false(in_array($role['Role']['name'], $this->Role->unEditable), '403');
$this->Role->del($id);
$msg = __('Role was successfully removed.', true);
$this->Message->add($msg, 'ok', true, array('action' => 'admin_index'));
}
示例3: beforeFilter
/**
* undocumented function
*
* @return void
* @access public
*/
function beforeFilter()
{
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
Assert::false($this->name == 'App', '404');
Assert::true(!!$this->action, '404');
}
$this->Session = $this->AppSession;
ClassRegistry::addObject('Component.Session', $this->Session);
ClassRegistry::addObject('Component.RequestHandler', $this->RequestHandler);
ClassRegistry::addObject('Component.Cookie', $this->Cookie);
ClassRegistry::addObject('Component.Email', $this->Email);
ClassRegistry::addObject('Component.Pgp', $this->Pgp);
$this->_loadPermissions();
$this->_setLanguage();
$this->_loadPluginConfigs();
if ($this->isAdmin()) {
$this->layout = 'admin';
}
if (defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
return;
}
$this->RequestHandler->setContent('list', 'text/html');
if (empty($this->ignoreUserSession)) {
$rules = Configure::read('App.userPermissions.' . User::get('Role.name'));
Assert::notEmpty($rules, '500');
$canAccess = Common::requestAllowed($this->name, $this->action, $rules, true);
if (!$canAccess) {
Assert::true(User::is('guest'), '403');
if ($this->isOkForSessionRedirect()) {
$this->Session->write($this->loginRedirectSesskey, $this->here);
}
$this->Session->write('cant_access', true);
return $this->redirect('/admin/auth/login', '403', true);
}
if (!User::is('guest') && $this->name == 'auth' && $this->action == 'login') {
$url = '/admin/home';
if ($this->Session->check($this->loginRedirectSesskey)) {
$url = $this->Session->read($this->loginRedirectSesskey);
}
$this->redirect($url);
}
}
$here = $this->params['url']['url'];
if (!empty($here) && $here[0] != '/') {
$here = '/' . $here;
}
$this->setJson('here', $here);
$ajax = $isAjax = false;
if ($this->isAjax()) {
$this->layout = 'ajax';
$ajax = $isAjax = true;
}
$this->set(compact('ajax', 'isAjax', 'here'));
}