本文整理汇总了PHP中skeeks\cms\helpers\UrlHelper::getCurrent方法的典型用法代码示例。如果您正苦于以下问题:PHP UrlHelper::getCurrent方法的具体用法?PHP UrlHelper::getCurrent怎么用?PHP UrlHelper::getCurrent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类skeeks\cms\helpers\UrlHelper
的用法示例。
在下文中一共展示了UrlHelper::getCurrent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isRequestOnValidateAjaxForm
/**
* Запрос пришел на валидацию ajax формы?
* @return bool
*/
public function isRequestOnValidateAjaxForm()
{
if (\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax && UrlHelper::getCurrent()->issetSystemParam(static::VALIDATION_AJAX_FORM_SYSTEM_NAME)) {
return true;
}
return false;
}
示例2: run
/**
* @return static
*/
public function run()
{
Yii::$app->user->logout();
if ($ref = UrlHelper::getCurrent()->getRef()) {
return Yii::$app->getResponse()->redirect($ref);
} else {
return Yii::$app->getResponse()->redirect(Yii::$app->getUser()->getReturnUrl());
}
}
示例3: actionRegister
/**
* Восстановлеине пароля
* @return string|Response
*/
public function actionRegister()
{
if (!\Yii::$app->user->isGuest) {
return $this->goHome();
}
$rr = new RequestResponse();
$model = new SignupForm();
$model->scenario = SignupForm::SCENARION_FULLINFO;
//Запрос на валидацию ajax формы
if ($rr->isRequestOnValidateAjaxForm()) {
return $rr->ajaxValidateForm($model);
}
//Запрос ajax post
if ($rr->isRequestAjaxPost()) {
if ($model->load(\Yii::$app->request->post()) && ($registeredUser = $model->signup())) {
$rr->success = true;
$rr->message = 'Вы успешно зарегистрированны';
\Yii::$app->user->login($registeredUser, 0);
return $this->redirect($registeredUser->getPageUrl());
} else {
$rr->message = 'Не удалось зарегистрироваться';
}
return (array) $rr;
} else {
if (\Yii::$app->request->isPost) {
if ($model->load(\Yii::$app->request->post()) && $model->sendEmail()) {
if ($ref = UrlHelper::getCurrent()->getRef()) {
return $this->redirect($ref);
} else {
return $this->goBack();
}
}
}
}
return $this->render('register', ['model' => $model]);
}
示例4: actionAuth
public function actionAuth()
{
$this->view->title = \Yii::t('app', 'Authorization');
$this->layout = '@skeeks/cms/modules/admin/views/layouts/unauthorized.php';
$goUrl = "";
$loginModel = new LoginFormUsernameOrEmail();
$passwordResetModel = new PasswordResetRequestFormEmailOrLogin();
if ($ref = UrlHelper::getCurrent()->getRef()) {
$goUrl = $ref;
}
$rr = new RequestResponse();
if (!\Yii::$app->user->isGuest) {
return $goUrl ? $this->redirect($goUrl) : $this->goHome();
}
//Авторизация
if (\Yii::$app->request->post('do') == 'login') {
if ($rr->isRequestOnValidateAjaxForm()) {
return $rr->ajaxValidateForm($loginModel);
}
if ($rr->isRequestAjaxPost()) {
if ($loginModel->load(\Yii::$app->request->post()) && $loginModel->login()) {
if (!$goUrl) {
$goUrl = Yii::$app->getUser()->getReturnUrl($defaultUrl);
}
$rr->redirect = $goUrl;
$rr->success = true;
$rr->message = "";
$rr->message = "";
return (array) $rr;
} else {
$rr->success = false;
$rr->message = \Yii::t('app', "Unsuccessful attempt authorization");
return (array) $rr;
}
}
}
//Запрос на сброс пароля
if (\Yii::$app->request->post('do') == 'password-reset') {
if ($rr->isRequestOnValidateAjaxForm()) {
return $rr->ajaxValidateForm($passwordResetModel);
}
if ($rr->isRequestAjaxPost()) {
if ($passwordResetModel->load(\Yii::$app->request->post()) && $passwordResetModel->sendEmail()) {
$rr->success = true;
$rr->message = \Yii::t('app', "Check your email address");
return (array) $rr;
} else {
$rr->success = false;
$rr->message = \Yii::t('app', "Failed send email");
return (array) $rr;
}
}
}
return $this->render('auth', ['loginModel' => $loginModel, 'passwordResetModel' => $passwordResetModel, 'goUrl' => $goUrl]);
}