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


PHP Piwik_Url::getCurrentUrl方法代码示例

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


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

示例1: setGeneralVariablesView

 protected function setGeneralVariablesView($view)
 {
     // date
     $view->date = $this->strDate;
     $oDate = new Piwik_Date($this->strDate);
     $view->prettyDate = $oDate->getLocalized(Piwik_Translate('Home_LocalizedDateFormat'));
     // period
     $currentPeriod = Piwik_Common::getRequestVar('period');
     $otherPeriodsAvailable = array('day', 'week', 'month', 'year');
     $otherPeriodsNames = array('day' => Piwik_Translate('Home_PeriodDay'), 'week' => Piwik_Translate('Home_PeriodWeek'), 'month' => Piwik_Translate('Home_PeriodMonth'), 'year' => Piwik_Translate('Home_PeriodYear'));
     $found = array_search($currentPeriod, $otherPeriodsAvailable);
     if ($found !== false) {
         unset($otherPeriodsAvailable[$found]);
     }
     $view->period = $currentPeriod;
     $view->otherPeriods = $otherPeriodsAvailable;
     $view->periodsNames = $otherPeriodsNames;
     // other
     $view->idSite = Piwik_Common::getRequestVar('idSite');
     $view->userLogin = Piwik::getCurrentUserLogin();
     $view->sites = Piwik_SitesManager_API::getSitesWithAtLeastViewAccess();
     $view->url = Piwik_Url::getCurrentUrl();
     $view->menu = Piwik_GetMenu();
     $view->menuJson = json_encode($view->menu);
     //var_dump($view->menuJson);
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:26,代码来源:Controller.php

示例2: render

 public function render()
 {
     try {
         $this->currentModule = Piwik::getModule();
         $this->currentPluginName = Piwik::getCurrentPlugin()->getName();
         $this->userLogin = Piwik::getCurrentUserLogin();
         $showWebsiteSelectorInUserInterface = Zend_Registry::get('config')->General->show_website_selector_in_user_interface;
         if ($showWebsiteSelectorInUserInterface) {
             $sites = Piwik_SitesManager_API::getSitesWithAtLeastViewAccess();
             usort($sites, create_function('$site1, $site2', 'return strcasecmp($site1["name"], $site2["name"]);'));
             $this->sites = $sites;
         }
         $this->showWebsiteSelectorInUserInterface = $showWebsiteSelectorInUserInterface;
         $this->url = Piwik_Url::getCurrentUrl();
         $this->token_auth = Piwik::getCurrentUserTokenAuth();
         $this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess();
         $this->userIsSuperUser = Piwik::isUserIsSuperUser();
         $this->piwik_version = Piwik_Version::VERSION;
         $this->latest_version_available = Piwik_UpdateCheck::isNewestVersionAvailable();
         $this->loginModule = Zend_Registry::get('auth')->getName();
     } catch (Exception $e) {
         // can fail, for example at installation (no plugin loaded yet)
     }
     $this->totalTimeGeneration = Zend_Registry::get('timer')->getTime();
     try {
         $this->totalNumberOfQueries = Piwik::getQueryCount();
     } catch (Exception $e) {
         $this->totalNumberOfQueries = 0;
     }
     header('Content-Type: text/html; charset=utf-8');
     header("Pragma: ");
     header("Cache-Control: no-store, must-revalidate");
     return $this->smarty->fetch($this->template);
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:34,代码来源:View.php

示例3: test_allMethods

 /**
  * display output of all methods
  */
 public function test_allMethods()
 {
     Piwik::createConfigObject();
     Piwik_Config::getInstance()->setTestEnvironment();
     $this->assertEqual(Piwik_Url::getCurrentQueryStringWithParametersModified(array()), Piwik_Url::getCurrentQueryString());
     $expectedUrl = parse_url(Piwik_Url::getCurrentUrl());
     $port = isset($expectedUrl['port']) ? ":{$expectedUrl['port']}" : '';
     $expectedUrl = $expectedUrl['scheme'] . '://' . $expectedUrl['host'] . $port . $expectedUrl['path'];
     $this->assertEqual($expectedUrl, Piwik_Url::getCurrentUrlWithoutQueryString());
     $this->assertEqual($expectedUrl, Piwik_Url::getCurrentScheme() . '://' . Piwik_Url::getCurrentHost() . Piwik_Url::getCurrentScriptName());
     print "<br/>\nPiwik_Url::getCurrentUrl() -> " . Piwik_Url::getCurrentUrl();
     print "<br/>\nPiwik_Url::getCurrentUrlWithoutQueryString() -> " . Piwik_Url::getCurrentUrlWithoutQueryString();
     print "<br/>\nPiwik_Url::getCurrentUrlWithoutFileName() -> " . Piwik_Url::getCurrentUrlWithoutFileName();
     print "<br/>\nPiwik_Url::getCurrentScriptPath() -> " . Piwik_Url::getCurrentScriptPath();
     print "<br/>\nPiwik_Url::getCurrentHost() -> " . Piwik_Url::getCurrentHost();
     print "<br/>\nPiwik_Url::getCurrentScriptName() -> " . Piwik_Url::getCurrentScriptName();
     print "<br/>\nPiwik_Url::getCurrentQueryString() -> " . Piwik_Url::getCurrentQueryString();
     print "<br/>\nPiwik_Url::getArrayFromCurrentQueryString() -> ";
     var_dump(Piwik_Url::getArrayFromCurrentQueryString());
     print "<br/>\nPiwik_Url::getCurrentQueryStringWithParametersModified() -> " . Piwik_Url::getCurrentQueryStringWithParametersModified(array());
     echo "<br/>\n\n";
     // setting parameter to null should remove it from url
     // test on Url.test.php?test=value
     $parameters = array_keys(Piwik_Url::getArrayFromCurrentQueryString());
     $parametersNameToValue = array();
     foreach ($parameters as $name) {
         $parametersNameToValue[$name] = null;
     }
     $this->assertEqual(Piwik_Url::getCurrentQueryStringWithParametersModified($parametersNameToValue), '');
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:33,代码来源:Url.test.php

示例4: __construct

 function __construct($action = '')
 {
     if (empty($action)) {
         $action = Piwik_Url::getCurrentUrl();
     }
     parent::HTML_QuickForm('form', 'POST', $action);
     $this->registerRule('checkEmail', 'function', 'Piwik_Form_isValidEmailString');
     $this->registerRule('fieldHaveSameValue', 'function', 'Piwik_Form_fieldHaveSameValue');
     $this->init();
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:10,代码来源:Form.php

示例5: index

	function index()
	{
		$view = Piwik_View::factory('UsersManager');
		
		$IdSitesAdmin = Piwik_SitesManager_API::getSitesIdWithAdminAccess();
		$idSiteSelected = 1;
		
		if(count($IdSitesAdmin) > 0)
		{
			$defaultWebsiteId = $IdSitesAdmin[0];
			$idSiteSelected = Piwik_Common::getRequestVar('idsite', $defaultWebsiteId);
		}
		
		if($idSiteSelected==='all')
		{
			$usersAccessByWebsite = array();
		}
		else
		{
			$usersAccessByWebsite = Piwik_UsersManager_API::getUsersAccessFromSite( $idSiteSelected );
		}
	
		// requires super user access
		$usersLogin = Piwik_UsersManager_API::getUsersLogin();
		
		// we dont want to display the user currently logged so that the user can't change his settings from admin to view...
		$currentlyLogged = Piwik::getCurrentUserLogin();
		foreach($usersLogin as $login)
		{
			if(!isset($usersAccessByWebsite[$login]))
			{
				$usersAccessByWebsite[$login] = 'noaccess';
			}
		}
		unset($usersAccessByWebsite[$currentlyLogged]);

		ksort($usersAccessByWebsite);
		
		$users = array();
		if(Zend_Registry::get('access')->isSuperUser())
		{
			$users = Piwik_UsersManager_API::getUsers();
		}
		
		$view->idSiteSelected = $idSiteSelected;
		$view->users = $users;
		$view->usersAccessByWebsite = $usersAccessByWebsite;
		$view->formUrl = Piwik_Url::getCurrentUrl();
		$view->websites = Piwik_SitesManager_API::getSitesWithAdminAccess();
		$this->setGeneralVariablesView($view);
		$view->menu = Piwik_GetAdminMenu();
		echo $view->render();
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:53,代码来源:Controller.php

示例6: getDefaultIndexView

 protected function getDefaultIndexView()
 {
     $view = new Piwik_View('AdminHome/templates/index.tpl');
     $view->menu = Piwik_GetAdminMenu();
     $view->menuJson = json_encode($view->menu);
     $view->userLogin = Piwik::getCurrentUserLogin();
     $view->sites = Piwik_SitesManager_API::getSitesWithAtLeastViewAccess();
     $view->url = Piwik_Url::getCurrentUrl();
     $view->basicHtmlView = false;
     $view->content = '';
     return $view;
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:12,代码来源:Controller.php

示例7: testAllMethods

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

示例8: render

 /**
  * Renders the current view.
  *
  * @return string Generated template
  */
 public function render()
 {
     try {
         $this->currentModule = Piwik::getModule();
         $this->currentAction = Piwik::getAction();
         $userLogin = Piwik::getCurrentUserLogin();
         $this->userLogin = $userLogin;
         // workaround for #1331
         $count = method_exists('Piwik', 'getWebsitesCountToDisplay') ? Piwik::getWebsitesCountToDisplay() : 1;
         $sites = Piwik_SitesManager_API::getInstance()->getSitesWithAtLeastViewAccess($count);
         usort($sites, create_function('$site1, $site2', 'return strcasecmp($site1["name"], $site2["name"]);'));
         $this->sites = $sites;
         $this->url = Piwik_Common::sanitizeInputValue(Piwik_Url::getCurrentUrl());
         $this->token_auth = Piwik::getCurrentUserTokenAuth();
         $this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess();
         $this->userIsSuperUser = Piwik::isUserIsSuperUser();
         $this->latest_version_available = Piwik_UpdateCheck::isNewestVersionAvailable();
         $this->disableLink = Piwik_Common::getRequestVar('disableLink', 0, 'int');
         $this->isWidget = Piwik_Common::getRequestVar('widget', 0, 'int');
         if (Zend_Registry::get('config')->General->autocomplete_min_sites <= count($sites)) {
             $this->show_autocompleter = true;
         } else {
             $this->show_autocompleter = false;
         }
         // workaround for #1331
         $this->loginModule = method_exists('Piwik', 'getLoginPluginName') ? Piwik::getLoginPluginName() : 'Login';
         $user = Piwik_UsersManager_API::getInstance()->getUser($userLogin);
         $this->userAlias = $user['alias'];
     } catch (Exception $e) {
         // can fail, for example at installation (no plugin loaded yet)
     }
     $this->totalTimeGeneration = Zend_Registry::get('timer')->getTime();
     try {
         $this->totalNumberOfQueries = Piwik::getQueryCount();
     } catch (Exception $e) {
         $this->totalNumberOfQueries = 0;
     }
     // workaround for #1331
     if (method_exists('Piwik', 'overrideCacheControlHeaders')) {
         Piwik::overrideCacheControlHeaders('no-store');
     }
     @header('Content-Type: ' . $this->contentType);
     if ($this->xFrameOptions) {
         @header('X-Frame-Options: ' . $this->xFrameOptions);
     }
     return $this->smarty->fetch($this->template);
 }
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:52,代码来源:View.php

示例9: render

 /**
  * Renders the current view.
  *
  * @return string Generated template
  */
 public function render()
 {
     try {
         $this->currentModule = Piwik::getModule();
         $this->currentAction = Piwik::getAction();
         $userLogin = Piwik::getCurrentUserLogin();
         $this->userLogin = $userLogin;
         $count = Piwik::getWebsitesCountToDisplay();
         $sites = Piwik_SitesManager_API::getInstance()->getSitesWithAtLeastViewAccess($count);
         usort($sites, create_function('$site1, $site2', 'return strcasecmp($site1["name"], $site2["name"]);'));
         $this->sites = $sites;
         $this->url = Piwik_Common::sanitizeInputValue(Piwik_Url::getCurrentUrl());
         $this->token_auth = Piwik::getCurrentUserTokenAuth();
         $this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess();
         $this->userIsSuperUser = Piwik::isUserIsSuperUser();
         $this->latest_version_available = Piwik_UpdateCheck::isNewestVersionAvailable();
         $this->disableLink = Piwik_Common::getRequestVar('disableLink', 0, 'int');
         $this->isWidget = Piwik_Common::getRequestVar('widget', 0, 'int');
         if (Piwik_Config::getInstance()->General['autocomplete_min_sites'] <= count($sites)) {
             $this->show_autocompleter = true;
         } else {
             $this->show_autocompleter = false;
         }
         $this->loginModule = Piwik::getLoginPluginName();
         $user = Piwik_UsersManager_API::getInstance()->getUser($userLogin);
         $this->userAlias = $user['alias'];
     } catch (Exception $e) {
         // can fail, for example at installation (no plugin loaded yet)
     }
     $this->totalTimeGeneration = Zend_Registry::get('timer')->getTime();
     try {
         $this->totalNumberOfQueries = Piwik::getQueryCount();
     } catch (Exception $e) {
         $this->totalNumberOfQueries = 0;
     }
     Piwik::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->smarty->fetch($this->template);
 }
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:46,代码来源:View.php

示例10: test_allMethods

 /**
  * display output of all methods
  */
 public function test_allMethods()
 {
     $this->assertEqual(Piwik_Url::getCurrentQueryStringWithParametersModified(array()), Piwik_Url::getCurrentQueryString());
     $this->assertEqual(Piwik_Url::getCurrentUrl(), Piwik_Url::getCurrentUrlWithoutQueryString());
     $this->assertEqual(Piwik_Url::getCurrentUrl(), Piwik_Url::getCurrentHost() . Piwik_Url::getCurrentScriptName());
     print "<br>\nPiwik_Url::getCurrentQueryStringWithParametersModified() " . Piwik_Url::getCurrentQueryStringWithParametersModified(array());
     print "<br>\nPiwik_Url::getCurrentUrl() " . Piwik_Url::getCurrentUrl();
     print "<br>\nPiwik_Url::getCurrentUrlWithoutQueryString() " . Piwik_Url::getCurrentUrlWithoutQueryString();
     print "<br>\nPiwik_Url::getCurrentUrlWithoutFileName() " . Piwik_Url::getCurrentUrlWithoutFileName();
     print "<br>\nPiwik_Url::getCurrentScriptName() " . Piwik_Url::getCurrentScriptName();
     print "<br>\nPiwik_Url::getCurrentScriptPath() " . Piwik_Url::getCurrentScriptPath();
     print "<br>\nPiwik_Url::getCurrentHost() " . Piwik_Url::getCurrentHost();
     print "<br>\nPiwik_Url::getCurrentQueryString() " . Piwik_Url::getCurrentQueryString();
     print "<br>\nPiwik_Url::getArrayFromCurrentQueryString() ";
     var_dump(Piwik_Url::getArrayFromCurrentQueryString());
     // setting parameter to null should remove it from url
     // test on Url.test.php?test=value
     $parameters = array_keys(Piwik_Url::getArrayFromCurrentQueryString());
     $parametersNameToValue = array();
     foreach ($parameters as $name) {
         $parametersNameToValue[$name] = null;
     }
     $this->assertEqual(Piwik_Url::getCurrentQueryStringWithParametersModified($parametersNameToValue), '');
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:27,代码来源:Url.test.php

示例11: init

 /**
  * Must be called before dispatch()
  * - checks that directories are writable,
  * - loads the configuration file,
  * - loads the plugin, 
  * - inits the DB connection,
  * - etc.
  */
 function init()
 {
     static $initialized = false;
     if ($initialized) {
         return;
     }
     $initialized = true;
     try {
         Zend_Registry::set('timer', new Piwik_Timer());
         $directoriesToCheck = array('/tmp/', '/tmp/templates_c/', '/tmp/cache/', '/tmp/assets/', '/tmp/tcpdf/');
         Piwik::checkDirectoriesWritableOrDie($directoriesToCheck);
         Piwik_Common::assignCliParametersToRequest();
         Piwik_Translate::getInstance()->loadEnglishTranslation();
         $exceptionToThrow = false;
         try {
             Piwik::createConfigObject();
         } catch (Exception $e) {
             Piwik_PostEvent('FrontController.NoConfigurationFile', $e, $info = array(), $pending = true);
             $exceptionToThrow = $e;
         }
         if (Piwik_Session::isFileBasedSessions()) {
             Piwik_Session::start();
         }
         if (Piwik_Config::getInstance()->General['maintenance_mode'] == 1 && !Piwik_Common::isPhpCliMode()) {
             $format = Piwik_Common::getRequestVar('format', '');
             $exception = new Exception("Piwik is in scheduled maintenance. Please come back later.");
             if (empty($format)) {
                 throw $exception;
             }
             $response = new Piwik_API_ResponseBuilder($format);
             echo $response->getResponseException($exception);
             exit;
         }
         if (!Piwik_Common::isPhpCliMode() && Piwik_Config::getInstance()->General['force_ssl'] == 1 && !Piwik::isHttps()) {
             $url = Piwik_Url::getCurrentUrl();
             $url = str_replace("http://", "https://", $url);
             Piwik_Url::redirectToUrl($url);
         }
         $pluginsManager = Piwik_PluginsManager::getInstance();
         $pluginsToLoad = Piwik_Config::getInstance()->Plugins['Plugins'];
         $pluginsManager->loadPlugins($pluginsToLoad);
         if ($exceptionToThrow) {
             throw $exceptionToThrow;
         }
         try {
             Piwik::createDatabaseObject();
         } catch (Exception $e) {
             if (self::shouldRethrowException()) {
                 throw $e;
             }
             Piwik_PostEvent('FrontController.badConfigurationFile', $e, $info = array(), $pending = true);
             throw $e;
         }
         Piwik::createLogObject();
         // creating the access object, so that core/Updates/* can enforce Super User and use some APIs
         Piwik::createAccessObject();
         Piwik_PostEvent('FrontController.dispatchCoreAndPluginUpdatesScreen');
         Piwik_PluginsManager::getInstance()->installLoadedPlugins();
         Piwik::install();
         // ensure the current Piwik URL is known for later use
         if (method_exists('Piwik', 'getPiwikUrl')) {
             $host = Piwik::getPiwikUrl();
         }
         Piwik_PostEvent('FrontController.initAuthenticationObject');
         try {
             $authAdapter = Zend_Registry::get('auth');
         } catch (Exception $e) {
             throw new Exception("Authentication object cannot be found in the Registry. Maybe the Login plugin is not activated?\n\t\t\t\t\t\t\t\t\t<br />You can activate the plugin by adding:<br />\n\t\t\t\t\t\t\t\t\t<code>Plugins[] = Login</code><br />\n\t\t\t\t\t\t\t\t\tunder the <code>[Plugins]</code> section in your config/config.ini.php");
         }
         Zend_Registry::get('access')->reloadAccess($authAdapter);
         Piwik::raiseMemoryLimitIfNecessary();
         Piwik_Translate::getInstance()->reloadLanguage();
         $pluginsManager->postLoadPlugins();
         Piwik_PostEvent('FrontController.checkForUpdates');
     } catch (Exception $e) {
         if (self::shouldRethrowException()) {
             throw $e;
         }
         Piwik_ExitWithMessage($e->getMessage(), false, true);
     }
     //		Piwik::log('End FrontController->init() - Request: '. var_export($_REQUEST, true));
 }
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:90,代码来源:FrontController.php

示例12: handleSSLRedirection

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


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