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


PHP Piwik::createAccessObject方法代码示例

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


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

示例1: initCorePiwikInTrackerMode

 protected static function initCorePiwikInTrackerMode()
 {
     static $init = false;
     if (!empty($GLOBALS['PIWIK_TRACKER_MODE']) && $init === false) {
         $init = true;
         require_once PIWIK_INCLUDE_PATH . '/core/Loader.php';
         require_once PIWIK_INCLUDE_PATH . '/core/Translate.php';
         require_once PIWIK_INCLUDE_PATH . '/core/Option.php';
         try {
             $access = Zend_Registry::get('access');
         } catch (Exception $e) {
             Piwik::createAccessObject();
         }
         try {
             $config = Zend_Registry::get('config');
         } catch (Exception $e) {
             Piwik::createConfigObject();
         }
         try {
             $db = Zend_Registry::get('db');
         } catch (Exception $e) {
             Piwik::createDatabaseObject();
         }
         $pluginsManager = Piwik_PluginsManager::getInstance();
         $pluginsToLoad = Zend_Registry::get('config')->Plugins->Plugins->toArray();
         $pluginsForcedNotToLoad = Piwik_Tracker::getPluginsNotToLoad();
         $pluginsToLoad = array_diff($pluginsToLoad, $pluginsForcedNotToLoad);
         $pluginsManager->loadPlugins($pluginsToLoad);
     }
 }
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:30,代码来源:Common.php

示例2: test_callableApiMethods_doNotFail

 function test_callableApiMethods_doNotFail()
 {
     Piwik::createConfigObject();
     Piwik_Config::getInstance()->setTestEnvironment();
     Piwik::createLogObject();
     Piwik::createAccessObject();
     Piwik::createDatabaseObject();
     Piwik::setUserIsSuperUser();
     Piwik_Translate::getInstance()->loadEnglishTranslation();
     $pluginsManager = Piwik_PluginsManager::getInstance();
     $pluginsManager->loadPlugins(Piwik_Config::getInstance()->Plugins['Plugins']);
     Piwik_SitesManager_API::getInstance()->addSite("name", "http://example.org");
     $apiGenerator = new Piwik_API_DocumentationGenerator_CallAllMethods();
     $requestUrls = $apiGenerator->getAllRequestsWithParameters();
     $this->assertTrue(count($requestUrls) > 20);
     foreach ($requestUrls as $url) {
         $call = new Piwik_API_Request($url);
         $output = $call->process();
         //			var_dump($url);
         //			var_dump($output);
         $this->assertTrue(!empty($output));
     }
     Piwik_Translate::getInstance()->unloadEnglishTranslation();
     $this->pass();
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:25,代码来源:DocumentationGenerator.test.php

示例3: getCacheWebsiteAttributes

 /**
  * Returns array containing data about the website: goals, URLs, etc.
  *
  * @param int $idSite
  * @return array
  */
 static function getCacheWebsiteAttributes($idSite)
 {
     require_once PIWIK_INCLUDE_PATH . '/core/Loader.php';
     static $cache = null;
     if (is_null($cache)) {
         $cache = new Piwik_CacheFile('tracker');
     }
     $filename = $idSite;
     $cacheContent = $cache->get($filename);
     if ($cacheContent !== false) {
         return $cacheContent;
     }
     if (defined('PIWIK_TRACKER_MODE') && PIWIK_TRACKER_MODE) {
         require_once PIWIK_INCLUDE_PATH . '/core/PluginsManager.php';
         require_once PIWIK_INCLUDE_PATH . '/core/Translate.php';
         require_once PIWIK_INCLUDE_PATH . '/core/Option.php';
         Zend_Registry::set('db', Piwik_Tracker::getDatabase());
         Piwik::createAccessObject();
         Piwik::createConfigObject();
         Piwik::setUserIsSuperUser();
         $pluginsManager = Piwik_PluginsManager::getInstance();
         $pluginsManager->setPluginsToLoad(Zend_Registry::get('config')->Plugins->Plugins->toArray());
     }
     $content = array();
     Piwik_PostEvent('Common.fetchWebsiteAttributes', $content, $idSite);
     // if nothing is returned from the plugins, we don't save the content
     // this is not expected: all websites are expected to have at least one URL
     if (!empty($content)) {
         $cache->set($filename, $content);
     }
     return $content;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:38,代码来源:Common.php

示例4: setUpBeforeClass

 public static function setUpBeforeClass($dbName = false, $createEmptyDatabase = true, $createConfig = true)
 {
     try {
         Piwik::$piwikUrlCache = '';
         if ($createConfig) {
             self::createTestConfig();
         }
         if ($dbName === false) {
             $dbName = Piwik_Config::getInstance()->database['dbname'];
         }
         self::connectWithoutDatabase();
         if ($createEmptyDatabase) {
             Piwik::dropDatabase();
         }
         Piwik::createDatabase($dbName);
         Piwik::disconnectDatabase();
         // reconnect once we're sure the database exists
         Piwik_Config::getInstance()->database['dbname'] = $dbName;
         Piwik::createDatabaseObject();
         Piwik::createTables();
         Piwik::createLogObject();
         Piwik_PluginsManager::getInstance()->loadPlugins(array());
     } catch (Exception $e) {
         self::fail("TEST INITIALIZATION FAILED: " . $e->getMessage());
     }
     include "DataFiles/SearchEngines.php";
     include "DataFiles/Languages.php";
     include "DataFiles/Countries.php";
     include "DataFiles/Currencies.php";
     include "DataFiles/LanguageToCountry.php";
     Piwik::createAccessObject();
     Piwik_PostEvent('FrontController.initAuthenticationObject');
     // We need to be SU to create websites for tests
     Piwik::setUserIsSuperUser();
     // Load and install plugins
     $pluginsManager = Piwik_PluginsManager::getInstance();
     $plugins = $pluginsManager->readPluginsDirectory();
     $pluginsManager->loadPlugins($plugins);
     if ($createEmptyDatabase) {
         $pluginsManager->installLoadedPlugins();
     }
     $_GET = $_REQUEST = array();
     $_SERVER['HTTP_REFERER'] = '';
     // Make sure translations are loaded to check messages in English
     Piwik_Translate::getInstance()->loadEnglishTranslation();
     Piwik_LanguagesManager_API::getInstance()->setLanguageForUser('superUserLogin', 'en');
     // List of Modules, or Module.Method that should not be called as part of the XML output compare
     // Usually these modules either return random changing data, or are already tested in specific unit tests.
     self::setApiNotToCall(self::$defaultApiNotToCall);
     self::setApiToCall(array());
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:51,代码来源:IntegrationTestCase.php

示例5: test_callableApiMethods_doNotFail

 function test_callableApiMethods_doNotFail()
 {
     Piwik::createConfigObject();
     Piwik::createLogObject();
     Piwik::createAccessObject();
     Piwik::createDatabaseObject();
     Piwik::setUserIsSuperUser();
     $pluginsManager = Piwik_PluginsManager::getInstance();
     $pluginsManager->setPluginsToLoad(Zend_Registry::get('config')->Plugins->Plugins->toArray());
     $apiGenerator = new Piwik_API_DocumentationGenerator_CallAllMethods();
     $requestUrls = $apiGenerator->getAllRequestsWithParameters();
     $this->assertTrue(count($requestUrls) > 20);
     foreach ($requestUrls as $url) {
         $call = new Piwik_API_Request($url);
         $output = $call->process();
         //			var_dump($url);
         //			var_dump($output);
         $this->assertTrue(!empty($output));
     }
     $this->pass();
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:21,代码来源:DocumentationGenerator.test.php

示例6: initObjectsToCallAPI

	/**
	 * Instantiate access and log objects
	 */
	protected function initObjectsToCallAPI()
	{
		// connect to the database using the DB infos currently in the session
		$this->createDbFromSessionInformation();

		Piwik::createAccessObject();
		Piwik::setUserIsSuperUser();
		Piwik::createLogObject();
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:12,代码来源:Controller.php

示例7: 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/'
			);
			
			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(Zend_Registry::get('config')->General->maintenance_mode == 1
				&& !Piwik_Common::isPhpCliMode())
			{
				throw new Exception("Piwik is in scheduled maintenance. Please come back later.");
			}
			
			$pluginsManager = Piwik_PluginsManager::getInstance();
			$pluginsManager->loadPlugins( Zend_Registry::get('config')->Plugins->Plugins->toArray() );

			if($exceptionToThrow)
			{
				throw $exceptionToThrow;
			}

			try {
				Piwik::createDatabaseObject();
			} catch(Exception $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?
									<br />You can activate the plugin by adding:<br />
									<code>Plugins[] = Login</code><br />
									under the <code>[Plugins]</code> section in your config/config.inc.php");
			}
			
			Zend_Registry::get('access')->reloadAccess($authAdapter);
			
			Piwik_Translate::getInstance()->reloadLanguage();

			Piwik::raiseMemoryLimitIfNecessary();

			$pluginsManager->postLoadPlugins();
			
			Piwik_PostEvent('FrontController.checkForUpdates');
		} catch(Exception $e) {
			Piwik_ExitWithMessage($e->getMessage(), false, true);
		}
		
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:101,代码来源:FrontController.php

示例8: 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()
 {
     try {
         Zend_Registry::set('timer', new Piwik_Timer());
         $directoriesToCheck = array('/tmp', '/tmp/templates_c', '/tmp/cache');
         Piwik::checkDirectoriesWritableOrDie($directoriesToCheck);
         self::assignCliParametersToRequest();
         Piwik_Translate::getInstance()->loadEnglishTranslation();
         $exceptionToThrow = false;
         try {
             Piwik::createConfigObject();
         } catch (Exception $e) {
             Piwik_PostEvent('FrontController.NoConfigurationFile', $e);
             $exceptionToThrow = $e;
         }
         $pluginsManager = Piwik_PluginsManager::getInstance();
         $pluginsManager->setPluginsToLoad(Zend_Registry::get('config')->Plugins->Plugins->toArray());
         if ($exceptionToThrow) {
             throw $exceptionToThrow;
         }
         Piwik_Translate::getInstance()->loadUserTranslation();
         try {
             Piwik::createDatabaseObject();
         } catch (Exception $e) {
             Piwik_PostEvent('FrontController.badConfigurationFile', $e);
             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();
         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.inc.php");
         }
         Zend_Registry::get('access')->reloadAccess($authAdapter);
         Piwik::raiseMemoryLimitIfNecessary();
         $pluginsManager->setLanguageToLoad(Piwik_Translate::getInstance()->getLanguageToLoad());
         $pluginsManager->postLoadPlugins();
         Piwik_PostEvent('FrontController.checkForUpdates');
     } catch (Exception $e) {
         Piwik_ExitWithMessage($e->getMessage(), $e->getTraceAsString(), true);
     }
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:56,代码来源:FrontController.php

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

示例10: __construct

 /**
  * Initializes the test
  * @param $title
  * @return void
  */
 function __construct($title = '')
 {
     parent::__construct($title);
     if (Test_Integration::$widgetTestingLevel != self::NO_WIDGET_TESTING) {
         self::initializeControllerTesting();
     }
     Piwik::createAccessObject();
     Piwik_PostEvent('FrontController.initAuthenticationObject');
     // We need to be SU to create websites for tests
     Piwik::setUserIsSuperUser();
     // Load and install plugins
     $pluginsManager = Piwik_PluginsManager::getInstance();
     $plugins = Piwik_Config::getInstance()->Plugins['Plugins'];
     $pluginsManager->loadPlugins($plugins);
     $pluginsManager->installLoadedPlugins();
 }
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:21,代码来源:Integration.php

示例11: getCacheWebsiteAttributes

 /**
  * Returns array containing data about the website: goals, URLs, etc.
  *
  * @param int $idSite
  * @return array
  */
 static function getCacheWebsiteAttributes($idSite)
 {
     static $cache = null;
     if (is_null($cache)) {
         require_once "CacheFile.php";
         $cache = new Piwik_CacheFile('tracker');
     }
     $filename = $idSite;
     $cacheContent = $cache->get($filename);
     if ($cacheContent !== false) {
         return $cacheContent;
     }
     if (defined('PIWIK_TRACKER_MODE') && PIWIK_TRACKER_MODE) {
         //TODO we can remove these includes when #620 is done
         require_once "Zend/Exception.php";
         require_once "Zend/Loader.php";
         require_once "Zend/Auth.php";
         require_once "Timer.php";
         require_once "PluginsManager.php";
         require_once "Piwik.php";
         require_once "Access.php";
         require_once "Auth.php";
         require_once "API/Proxy.php";
         require_once "Archive.php";
         require_once "Site.php";
         require_once "Date.php";
         require_once "DataTable.php";
         require_once "Translate.php";
         require_once "Mail.php";
         require_once "Url.php";
         require_once "Controller.php";
         require_once "Option.php";
         require_once "View.php";
         require_once "UpdateCheck.php";
         Zend_Registry::set('db', Piwik_Tracker::getDatabase());
         Piwik::createAccessObject();
         Piwik::createConfigObject();
         Piwik::setUserIsSuperUser();
         $pluginsManager = Piwik_PluginsManager::getInstance();
         $pluginsManager->setPluginsToLoad(Zend_Registry::get('config')->Plugins->Plugins->toArray());
     }
     $content = array();
     Piwik_PostEvent('Common.fetchWebsiteAttributes', $content, $idSite);
     // if nothing is returned from the plugins, we don't save the content
     // this is not expected: all websites are expected to have at least one URL
     if (!empty($content)) {
         $cache->set($filename, $content);
     }
     return $content;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:56,代码来源:Common.php

示例12: createAccessObject

 protected function createAccessObject()
 {
     Piwik::createAccessObject();
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:4,代码来源:FrontController.php


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