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


PHP Url::redirectToUrl方法代码示例

本文整理汇总了PHP中Piwik\Url::redirectToUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::redirectToUrl方法的具体用法?PHP Url::redirectToUrl怎么用?PHP Url::redirectToUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik\Url的用法示例。


在下文中一共展示了Url::redirectToUrl方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dispatch

 /**
  * Executes the requested plugin controller method.
  *
  * @throws Exception|\Piwik\PluginDeactivatedException in case the plugin doesn't exist, the action doesn't exist,
  *                                                     there is not enough permission, etc.
  *
  * @param string $module The name of the plugin whose controller to execute, eg, `'UserCountryMap'`.
  * @param string $action The controller method name, eg, `'realtimeMap'`.
  * @param array $parameters Array of parameters to pass to the controller method.
  * @return void|mixed The returned value of the call. This is the output of the controller method.
  * @api
  */
 public function dispatch($module = null, $action = null, $parameters = null)
 {
     if (self::$enableDispatch === false) {
         return;
     }
     $filter = new Router();
     $redirection = $filter->filterUrl(Url::getCurrentUrl());
     if ($redirection !== null) {
         Url::redirectToUrl($redirection);
         return;
     }
     try {
         $result = $this->doDispatch($module, $action, $parameters);
         return $result;
     } catch (NoAccessException $exception) {
         Log::debug($exception);
         /**
          * Triggered when a user with insufficient access permissions tries to view some resource.
          *
          * This event can be used to customize the error that occurs when a user is denied access
          * (for example, displaying an error message, redirecting to a page other than login, etc.).
          *
          * @param \Piwik\NoAccessException $exception The exception that was caught.
          */
         Piwik::postEvent('User.isNotAuthorized', array($exception), $pending = true);
     }
 }
开发者ID:drabberhorizon,项目名称:ActiveNative,代码行数:39,代码来源:FrontController.php

示例2: logout

 /**
  * Logout current user
  *
  * @param none
  * @return void
  */
 public function logout()
 {
     self::clearSession();
     $logoutUrl = @Config::getInstance()->General['login_logout_url'];
     if (empty($logoutUrl)) {
         Piwik::redirectToModule('CoreHome');
     } else {
         Url::redirectToUrl($logoutUrl);
     }
 }
开发者ID:signalshare,项目名称:piwik,代码行数:16,代码来源:Controller.php

示例3: redirectToIndex

 /**
  * Helper method used to redirect the current HTTP request to another module/action.
  * 
  * This function will exit immediately after executing.
  *
  * @param string $moduleToRedirect The plugin to redirect to, eg. `"MultiSites"`.
  * @param string $actionToRedirect Action, eg. `"index"`.
  * @param int|null $websiteId The new idSite query parameter, eg, `1`.
  * @param string|null $defaultPeriod The new period query parameter, eg, `'day'`.
  * @param string|null $defaultDate The new date query parameter, eg, `'today'`.
  * @param array $parameters Other query parameters to append to the URL.
  * @api
  */
 public function redirectToIndex($moduleToRedirect, $actionToRedirect, $websiteId = null, $defaultPeriod = null, $defaultDate = null, $parameters = array())
 {
     $userPreferences = new UserPreferences();
     if (empty($websiteId)) {
         $websiteId = $userPreferences->getDefaultWebsiteId();
     }
     if (empty($defaultDate)) {
         $defaultDate = $userPreferences->getDefaultDate();
     }
     if (empty($defaultPeriod)) {
         $defaultPeriod = $userPreferences->getDefaultPeriod();
     }
     $parametersString = '';
     if (!empty($parameters)) {
         $parametersString = '&' . Url::getQueryStringFromParameters($parameters);
     }
     if ($websiteId) {
         $url = "index.php?module=" . $moduleToRedirect . "&action=" . $actionToRedirect . "&idSite=" . $websiteId . "&period=" . $defaultPeriod . "&date=" . $defaultDate . $parametersString;
         Url::redirectToUrl($url);
         exit;
     }
     if (Piwik::hasUserSuperUserAccess()) {
         Piwik_ExitWithMessage("Error: no website was found in this Piwik installation.\n\t\t\t<br />Check the table '" . Common::prefixTable('site') . "' in your database, it should contain your Piwik websites.", false, true);
     }
     $currentLogin = Piwik::getCurrentUserLogin();
     if (!empty($currentLogin) && $currentLogin != 'anonymous') {
         $emails = implode(',', Piwik::getAllSuperUserAccessEmailAddresses());
         $errorMessage = sprintf(Piwik::translate('CoreHome_NoPrivilegesAskPiwikAdmin'), $currentLogin, "<br/><a href='mailto:" . $emails . "?subject=Access to Piwik for user {$currentLogin}'>", "</a>");
         $errorMessage .= "<br /><br />&nbsp;&nbsp;&nbsp;<b><a href='index.php?module=" . Registry::get('auth')->getName() . "&amp;action=logout'>&rsaquo; " . Piwik::translate('General_Logout') . "</a></b><br />";
         Piwik_ExitWithMessage($errorMessage, false, true);
     }
     echo FrontController::getInstance()->dispatch(Piwik::getLoginPluginName(), false);
     exit;
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:47,代码来源:Controller.php

示例4: redirectToModule

 /**
  * Redirects the current request to a new module and action.
  *
  * @param string $newModule The target module, eg, `'UserCountry'`.
  * @param string $newAction The target controller action, eg, `'index'`.
  * @param array $parameters The query parameter values to modify before redirecting.
  * @api
  */
 public static function redirectToModule($newModule, $newAction = '', $parameters = array())
 {
     $newUrl = 'index.php' . Url::getCurrentQueryStringWithParametersModified(array('module' => $newModule, 'action' => $newAction) + $parameters);
     Url::redirectToUrl($newUrl);
 }
开发者ID:GovanifY,项目名称:piwik,代码行数:13,代码来源:Piwik.php

示例5: finished

 /**
  * Installation Step 8: Finished!
  */
 public function finished()
 {
     $this->checkPiwikIsNotInstalled();
     $view = new View('@Installation/finished', $this->getInstallationSteps(), __FUNCTION__);
     $form = new FormDefaultSettings();
     /**
      * Triggered on initialization of the form to customize default Piwik settings (at the end of the installation process).
      *
      * @param \Piwik\Plugins\Installation\FormDefaultSettings $form
      */
     Piwik::postEvent('Installation.defaultSettingsForm.init', array($form));
     $form->addElement('submit', 'submit', array('value' => Piwik::translate('General_ContinueToPiwik') . ' »', 'class' => 'btn btn-lg'));
     if ($form->validate()) {
         try {
             /**
              * Triggered on submission of the form to customize default Piwik settings (at the end of the installation process).
              *
              * @param \Piwik\Plugins\Installation\FormDefaultSettings $form
              */
             Piwik::postEvent('Installation.defaultSettingsForm.submit', array($form));
             $this->markInstallationAsCompleted();
             Url::redirectToUrl('index.php');
         } catch (Exception $e) {
             $view->errorMessage = $e->getMessage();
         }
     }
     $view->addForm($form);
     $view->showNextStep = false;
     $output = $view->render();
     return $output;
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:34,代码来源:Controller.php

示例6: doRedirectToUrl

 /**
  * @param $moduleToRedirect
  * @param $actionToRedirect
  * @param $websiteId
  * @param $defaultPeriod
  * @param $defaultDate
  * @param $parameters
  * @throws Exception
  */
 private function doRedirectToUrl($moduleToRedirect, $actionToRedirect, $websiteId, $defaultPeriod, $defaultDate, $parameters)
 {
     $menu = new Menu();
     $parameters = array_merge($menu->urlForDefaultUserParams($websiteId, $defaultPeriod, $defaultDate), $parameters);
     $queryParams = !empty($parameters) ? '&' . Url::getQueryStringFromParameters($parameters) : '';
     $url = "index.php?module=%s&action=%s";
     $url = sprintf($url, $moduleToRedirect, $actionToRedirect);
     $url = $url . $queryParams;
     Url::redirectToUrl($url);
 }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:19,代码来源:Controller.php

示例7: regenerate

 /**
  * Action to generate a new Google Authenticator secret for the current user
  *
  * @return string
  * @throws \Exception
  * @throws \Piwik\NoAccessException
  */
 public function regenerate()
 {
     Piwik::checkUserIsNotAnonymous();
     $view = new View('@GoogleAuthenticator/regenerate');
     $this->setGeneralVariablesView($view);
     $googleAuth = new PHPGangsta\GoogleAuthenticator();
     $storage = new Storage(Piwik::getCurrentUserLogin());
     $secret = Common::getRequestVar('gasecret', '', 'string');
     $authCode = Common::getRequestVar('gaauthcode', '', 'string');
     $authCodeNonce = Common::getRequestVar('authCodeNonce', '', 'string');
     $title = Common::getRequestVar('gatitle', $storage->getTitle(), 'string');
     $description = Common::getRequestVar('gadescription', $storage->getDescription(), 'string');
     if (!empty($secret) && !empty($authCode) && Nonce::verifyNonce(self::AUTH_CODE_NONCE, $authCodeNonce) && $googleAuth->verifyCode($secret, $authCode, 2)) {
         $storage->setSecret($secret);
         $storage->setDescription($description);
         $storage->setTitle($title);
         $this->auth->setAuthCode($authCode);
         $this->auth->validateAuthCode();
         Url::redirectToUrl(Url::getCurrentUrlWithoutQueryString() . Url::getCurrentQueryStringWithParametersModified(array('action' => 'settings', 'activate' => '1')));
     }
     if (empty($secret)) {
         $secret = $googleAuth->createSecret(32);
     }
     $view->title = $title;
     $view->description = $description;
     $view->authCodeNonce = Nonce::getNonce(self::AUTH_CODE_NONCE);
     $view->newSecret = $secret;
     $view->googleAuthImage = $googleAuth->getQRCodeGoogleUrl($description, $secret, $title);
     return $view->render();
 }
开发者ID:sgiehl,项目名称:piwik-plugin-GoogleAuthenticator,代码行数:37,代码来源:Controller.php

示例8: performRedirectToUrlIfSet

 private function performRedirectToUrlIfSet()
 {
     if (!$this->hasRedirectUrl()) {
         return;
     }
     if (empty($this->requests)) {
         return;
     }
     $redirectUrl = $this->getRedirectUrl();
     $host = Url::getHostFromUrl($redirectUrl);
     if (empty($host)) {
         return;
     }
     $siteIds = array();
     foreach ($this->requests as $request) {
         $siteIds[] = (int) $request['idsite'];
     }
     $siteIds = array_unique($siteIds);
     $model = new Model();
     foreach ($siteIds as $siteId) {
         $siteUrls = $model->getSiteUrlsFromId($siteId);
         if (Url::isHostInUrls($host, $siteUrls)) {
             Url::redirectToUrl($redirectUrl);
         }
     }
 }
开发者ID:mats116,项目名称:piwik,代码行数:26,代码来源:Tracker.php

示例9: redirectToPaypal

 /**
  * Redirects the user to a paypal so they can donate to Piwik.
  */
 public function redirectToPaypal()
 {
     $parameters = Request::getRequestArrayFromString($request = null);
     foreach ($parameters as $name => $param) {
         if ($name == 'idSite' || $name == 'module' || $name == 'action') {
             unset($parameters[$name]);
         }
     }
     $url = "https://www.paypal.com/cgi-bin/webscr?" . Url::getQueryStringFromParameters($parameters);
     Url::redirectToUrl($url);
     exit;
 }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:15,代码来源:Controller.php

示例10: checkForceSslLogin

 /**
  * Check force_ssl_login and redirect if connection isn't secure and not using a reverse proxy
  *
  * @param none
  * @return void
  */
 protected function checkForceSslLogin()
 {
     $forceSslLogin = Config::getInstance()->General['force_ssl_login'];
     if ($forceSslLogin && !ProxyHttp::isHttps()) {
         $url = 'https://' . Url::getCurrentHost() . Url::getCurrentScriptName() . Url::getCurrentQueryString();
         Url::redirectToUrl($url);
     }
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:14,代码来源:Controller.php

示例11: handleSSLRedirection

 protected function handleSSLRedirection()
 {
     if (!Common::isPhpCliMode() && Config::getInstance()->General['force_ssl'] == 1 && !ProxyHttp::isHttps() && !(Common::getRequestVar('module', '') == 'CoreAdminHome' && Common::getRequestVar('action', '') == 'optOut')) {
         $url = Url::getCurrentUrl();
         $url = str_replace("http://", "https://", $url);
         Url::redirectToUrl($url);
     }
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:8,代码来源:FrontController.php

示例12: performRedirectToUrlIfSet

 private function performRedirectToUrlIfSet()
 {
     if (!$this->hasRedirectUrl()) {
         return;
     }
     if (empty($this->requests)) {
         return;
     }
     $redirectUrl = $this->getRedirectUrl();
     $host = Url::getHostFromUrl($redirectUrl);
     if (empty($host)) {
         return;
     }
     $urls = new SiteUrls();
     $siteUrls = $urls->getAllCachedSiteUrls();
     $siteIds = $this->getAllSiteIdsWithinRequest();
     foreach ($siteIds as $siteId) {
         if (empty($siteUrls[$siteId])) {
             continue;
         }
         if (Url::isHostInUrls($host, $siteUrls[$siteId])) {
             Url::redirectToUrl($redirectUrl);
         }
     }
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:25,代码来源:Tracker.php

示例13: redirectIfNeeded

 protected function redirectIfNeeded(RequestSet $requestSet)
 {
     $redirectUrl = $requestSet->shouldPerformRedirectToUrl();
     if (!empty($redirectUrl)) {
         Url::redirectToUrl($redirectUrl);
     }
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:7,代码来源:Handler.php

示例14: logout

 /**
  * Logout current user
  *
  * @param none
  * @return void
  */
 public function logout()
 {
     Piwik::postEvent('Login.logout', array(Piwik::getCurrentUserLogin()));
     self::clearSession();
     $logoutUrl = @Config::getInstance()->General['login_logout_url'];
     if (empty($logoutUrl)) {
         Piwik::redirectToModule('CoreHome');
     } else {
         Url::redirectToUrl($logoutUrl);
     }
 }
开发者ID:piwik,项目名称:piwik,代码行数:17,代码来源:Controller.php


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