当前位置: 首页>>代码示例>>PHP>>正文


PHP UrlHelper::getCurrent方法代码示例

本文整理汇总了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;
 }
开发者ID:Liv1020,项目名称:cms,代码行数:11,代码来源:RequestResponse.php

示例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());
     }
 }
开发者ID:Liv1020,项目名称:cms,代码行数:12,代码来源:LogoutAction.php

示例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]);
 }
开发者ID:dextercool,项目名称:cms,代码行数:40,代码来源:AuthController.php

示例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]);
 }
开发者ID:Liv1020,项目名称:cms,代码行数:55,代码来源:AuthController.php


注:本文中的skeeks\cms\helpers\UrlHelper::getCurrent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。