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


PHP Url::getCurrentUrl方法代码示例

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


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

 /**
  * @group Core
  */
 public function testAllMethods()
 {
     $this->assertEquals(Url::getCurrentQueryStringWithParametersModified(array()), Url::getCurrentQueryString());
     $this->assertEquals(Url::getCurrentUrl(), Url::getCurrentUrlWithoutQueryString());
     $this->assertEquals(Url::getCurrentUrl(), Url::getCurrentScheme() . '://' . Url::getCurrentHost() . Url::getCurrentScriptName());
     $_SERVER['QUERY_STRING'] = 'q=test';
     $parameters = array_keys(Url::getArrayFromCurrentQueryString());
     $parametersNameToValue = array();
     foreach ($parameters as $name) {
         $parametersNameToValue[$name] = null;
     }
     $this->assertEquals('', Url::getCurrentQueryStringWithParametersModified($parametersNameToValue));
 }
开发者ID:Abine,项目名称:piwik,代码行数:16,代码来源:UrlTest.php

示例3: testMisconfiguredNginxPathInfo

 /**
  * Tests a use case that was reported by some users: Nginx is not properly configured and passes
  * incorrect PATH_INFO values in $_SERVER.
  * @link https://github.com/piwik/piwik/issues/6491
  * @group Core
  */
 public function testMisconfiguredNginxPathInfo()
 {
     $this->resetGlobalVariables();
     // these variables where taken from a bug report
     $_SERVER = array('QUERY_STRING' => 'foo=bar', 'PATH_INFO' => '/test.php', 'SCRIPT_NAME' => '/test.php', 'REQUEST_URI' => '/test.php?foo=bar', 'DOCUMENT_URI' => '/test.php', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'SERVER_NAME' => 'example.com', 'HTTP_HOST' => 'example.com', 'PHP_SELF' => '/test.php/test.php');
     $expectedUrl = 'http://example.com/test.php?foo=bar';
     $this->assertEquals($expectedUrl, Url::getCurrentUrl());
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:14,代码来源:UrlTest.php

示例4: render

 /**
  * Renders the current view. Also sends the stored 'Content-Type' HTML header.
  * See {@link setContentType()}.
  *
  * @return string Generated template.
  */
 public function render()
 {
     try {
         $this->currentModule = Piwik::getModule();
         $this->currentAction = Piwik::getAction();
         $this->url = Common::sanitizeInputValue(Url::getCurrentUrl());
         $this->token_auth = Piwik::getCurrentUserTokenAuth();
         $this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess();
         $this->userIsAnonymous = Piwik::isUserIsAnonymous();
         $this->userIsSuperUser = Piwik::hasUserSuperUserAccess();
         $this->latest_version_available = UpdateCheck::isNewestVersionAvailable();
         $this->disableLink = Common::getRequestVar('disableLink', 0, 'int');
         $this->isWidget = Common::getRequestVar('widget', 0, 'int');
         $piwikAds = StaticContainer::get('Piwik\\ProfessionalServices\\Advertising');
         $this->areAdsForProfessionalServicesEnabled = $piwikAds->areAdsForProfessionalServicesEnabled();
         if (Development::isEnabled()) {
             $cacheBuster = rand(0, 10000);
         } else {
             $cacheBuster = UIAssetCacheBuster::getInstance()->piwikVersionBasedCacheBuster();
         }
         $this->cacheBuster = $cacheBuster;
         $this->loginModule = Piwik::getLoginPluginName();
         $user = APIUsersManager::getInstance()->getUser($this->userLogin);
         $this->userAlias = $user['alias'];
     } catch (Exception $e) {
         Log::debug($e);
         // can fail, for example at installation (no plugin loaded yet)
     }
     ProxyHttp::overrideCacheControlHeaders('no-store');
     Common::sendHeader('Content-Type: ' . $this->contentType);
     // always sending this header, sometimes empty, to ensure that Dashboard embed loads
     // - when calling sendHeader() multiple times, the last one prevails
     Common::sendHeader('X-Frame-Options: ' . (string) $this->xFrameOptions);
     return $this->renderTwigTemplate();
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:41,代码来源:View.php

示例5: render

 /**
  * Renders the current view. Also sends the stored 'Content-Type' HTML header.
  * See {@link setContentType()}.
  *
  * @return string Generated template.
  */
 public function render()
 {
     try {
         $this->currentModule = Piwik::getModule();
         $this->currentAction = Piwik::getAction();
         $this->url = Common::sanitizeInputValue(Url::getCurrentUrl());
         $this->token_auth = Piwik::getCurrentUserTokenAuth();
         $this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess();
         $this->userIsSuperUser = Piwik::hasUserSuperUserAccess();
         $this->latest_version_available = UpdateCheck::isNewestVersionAvailable();
         $this->disableLink = Common::getRequestVar('disableLink', 0, 'int');
         $this->isWidget = Common::getRequestVar('widget', 0, 'int');
         $this->cacheBuster = UIAssetCacheBuster::getInstance()->piwikVersionBasedCacheBuster();
         $this->loginModule = Piwik::getLoginPluginName();
         $user = APIUsersManager::getInstance()->getUser($this->userLogin);
         $this->userAlias = $user['alias'];
     } catch (Exception $e) {
         // can fail, for example at installation (no plugin loaded yet)
     }
     try {
         $this->totalTimeGeneration = Registry::get('timer')->getTime();
         $this->totalNumberOfQueries = Profiler::getQueryCount();
     } catch (Exception $e) {
         $this->totalNumberOfQueries = 0;
     }
     ProxyHttp::overrideCacheControlHeaders('no-store');
     @header('Content-Type: ' . $this->contentType);
     // always sending this header, sometimes empty, to ensure that Dashboard embed loads (which could call this header() multiple times, the last one will prevail)
     @header('X-Frame-Options: ' . (string) $this->xFrameOptions);
     return $this->renderTwigTemplate();
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:37,代码来源:View.php

示例6: 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

示例7: testGetCurrentUrl

 /**
  * @group Core
  * @dataProvider urlProvider
  */
 public function testGetCurrentUrl($url, $pathInfo = null)
 {
     $this->resetGlobalVariables();
     $this->setGlobalVariablesFromUrl($url, $pathInfo);
     $this->assertEquals($url, Url::getCurrentUrl());
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:10,代码来源:UrlTest.php

示例8: render

 /**
  * Renders the current view. Also sends the stored 'Content-Type' HTML header.
  * See {@link setContentType()}.
  *
  * @return string Generated template.
  */
 public function render()
 {
     try {
         $this->currentModule = Piwik::getModule();
         $this->currentAction = Piwik::getAction();
         $userLogin = Piwik::getCurrentUserLogin();
         $this->userLogin = $userLogin;
         $count = SettingsPiwik::getWebsitesCountToDisplay();
         $sites = APISitesManager::getInstance()->getSitesWithAtLeastViewAccess($count);
         usort($sites, function ($site1, $site2) {
             return strcasecmp($site1["name"], $site2["name"]);
         });
         $this->sites = $sites;
         $this->url = Common::sanitizeInputValue(Url::getCurrentUrl());
         $this->token_auth = Piwik::getCurrentUserTokenAuth();
         $this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess();
         $this->userIsSuperUser = Piwik::isUserIsSuperUser();
         $this->latest_version_available = UpdateCheck::isNewestVersionAvailable();
         $this->disableLink = Common::getRequestVar('disableLink', 0, 'int');
         $this->isWidget = Common::getRequestVar('widget', 0, 'int');
         if (Config::getInstance()->General['autocomplete_min_sites'] <= count($sites)) {
             $this->show_autocompleter = true;
         } else {
             $this->show_autocompleter = false;
         }
         $this->loginModule = Piwik::getLoginPluginName();
         $user = APIUsersManager::getInstance()->getUser($userLogin);
         $this->userAlias = $user['alias'];
     } catch (Exception $e) {
         // can fail, for example at installation (no plugin loaded yet)
     }
     try {
         $this->totalTimeGeneration = Registry::get('timer')->getTime();
         $this->totalNumberOfQueries = Profiler::getQueryCount();
     } catch (Exception $e) {
         $this->totalNumberOfQueries = 0;
     }
     ProxyHttp::overrideCacheControlHeaders('no-store');
     @header('Content-Type: ' . $this->contentType);
     // always sending this header, sometimes empty, to ensure that Dashboard embed loads (which could call this header() multiple times, the last one will prevail)
     @header('X-Frame-Options: ' . (string) $this->xFrameOptions);
     return $this->renderTwigTemplate();
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:49,代码来源:View.php


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