當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。