本文整理匯總了PHP中UrlHelper::referer方法的典型用法代碼示例。如果您正苦於以下問題:PHP UrlHelper::referer方法的具體用法?PHP UrlHelper::referer怎麽用?PHP UrlHelper::referer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UrlHelper
的用法示例。
在下文中一共展示了UrlHelper::referer方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: login_process
function login_process()
{
$form = $this->load->form('login', $_POST);
if (!$form->validate()) {
Session::setFlash('next', $form->next->getValue());
$this->helper->redirect->flash(UrlHelper::referer(), $form->getId(), $form->getFlashParams());
}
$values = $form->getValue();
if ($form->next->getValue()) {
#Parameters 'auth' => 'login' are passed as a flash to the next page
$this->view->setRedirect($form->next->getValue(), 'auth', 'login');
} else {
$this->view->setRedirect('/');
}
$user_id = $this->db->Auth->getUserId($values['username'], $values['password']);
if (!$user_id && $this->config['old_password']) {
$user_id = $this->db->Auth->getUserIdFromOldPassword($values['username'], $form->password->getRawValue());
}
if (!$user_id) {
$form->username->setErrorCode('invalid');
$this->helper->redirect->flash(UrlHelper::referer(), $form->getId(), $form->getFlashParams());
}
if (!$this->db->Auth->isEnabled($user_id)) {
$this->helper->redirect->flash(UrlHelper::referer(), $form->getId(), $form->getFlashParams());
}
if (!$this->db->Auth->isActivated($user_id)) {
$this->helper->redirect->to('/auth/unconfirmed');
}
$this->plugin->Auth->login($user_id, $form->remember->isChecked(), $values['module']);
}
示例2: addRedirectLines
protected function addRedirectLines()
{
if ($this->config['show_redirect']) {
$lines = $this->session->getFlash('console');
if ($lines) {
$this->addLine('-- FROM PREVIOUS PAGE --', 'redirect', UrlHelper::referer(true), false);
$this->lines = array_merge($this->lines, $lines);
}
}
}
示例3: __construct
function __construct($context)
{
$referer = UrlHelper::referer();
$this->next = $referer ? $referer : $context->getModule();
parent::__construct($context);
}
示例4: validateOrRedirect
final function validateOrRedirect($url = null)
{
if (!$url) {
$url = UrlHelper::referer();
}
if (!$url) {
$url = '/';
}
if (!$this->validate()) {
RedirectHelper::flash($url, $this->getId(), $this->getFlashParams());
}
}