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


PHP Piwik_PluginsManager类代码示例

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


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

示例1: process

 /**
  * Handles the request to the API.
  * It first checks that the method called (parameter 'method') is available in the module (it means that the method exists and is public)
  * It then reads the parameters from the request string and throws an exception if there are missing parameters.
  * It then calls the API Proxy which will call the requested method.
  * 
  * @return mixed The data resulting from the API call  
  */
 public function process()
 {
     // read the format requested for the output data
     $outputFormat = strtolower(Piwik_Common::getRequestVar('format', 'xml', 'string', $this->request));
     // create the response
     $response = new Piwik_API_ResponseBuilder($this->request, $outputFormat);
     try {
         // read parameters
         $moduleMethod = Piwik_Common::getRequestVar('method', null, null, $this->request);
         list($module, $method) = $this->extractModuleAndMethod($moduleMethod);
         if (!Piwik_PluginsManager::getInstance()->isPluginActivated($module)) {
             throw new Piwik_FrontController_PluginDeactivatedException($module);
         }
         $module = "Piwik_" . $module . "_API";
         // if a token_auth is specified in the API request, we load the right permissions
         $token_auth = Piwik_Common::getRequestVar('token_auth', '', 'string', $this->request);
         if ($token_auth) {
             Piwik_PostEvent('API.Request.authenticate', $token_auth);
             Zend_Registry::get('access')->reloadAccess();
         }
         // call the method
         $returnedValue = Piwik_API_Proxy::getInstance()->call($module, $method, $this->request);
         $toReturn = $response->getResponse($returnedValue);
     } catch (Exception $e) {
         $toReturn = $response->getResponseException($e);
     }
     return $toReturn;
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:36,代码来源:Request.php

示例2: update

 static function update()
 {
     try {
         Piwik_PluginsManager::getInstance()->activatePlugin('CustomVariables');
     } catch (Exception $e) {
     }
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:7,代码来源:1.2-rc2.php

示例3: dispatch

	function dispatch()
	{
		$language = Piwik_Common::getRequestVar('language', '', 'string');
		if($language != '')
		{
			$updaterController = new Piwik_CoreUpdater_Controller();
			$updaterController->saveLanguage();
			exit;
		}

		$updater = new Piwik_Updater();
		$updater->addComponentToCheck('core', Piwik_Version::VERSION);
		
		$plugins = Piwik_PluginsManager::getInstance()->getInstalledPlugins();
		foreach($plugins as $pluginName => $plugin)
		{
			$updater->addComponentToCheck($pluginName, $plugin->getVersion());
		}
		
		$componentsWithUpdateFile = $updater->getComponentsWithUpdateFile();
		if(count($componentsWithUpdateFile) == 0)
		{
			return;
		}
			
		$updaterController = new Piwik_CoreUpdater_Controller();
		$updaterController->runUpdaterAndExit($updater, $componentsWithUpdateFile);
	}	
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:28,代码来源:CoreUpdater.php

示例4: getInstance

 /**
  * Returns the singleton Piwik_PluginsManager
  *
  * @return Piwik_PluginsManager
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:12,代码来源:PluginsManager.php

示例5: update

	static function update()
	{
		// first we disable the plugins and keep an array of warnings messages 
		$pluginsToDisableMessage = array(
			'SearchEnginePosition' => "SearchEnginePosition plugin was disabled, because it is not compatible with the new Piwik 0.6. \n You can download the latest version of the plugin, compatible with Piwik 0.6.\n<a target='_blank' href='?module=Proxy&action=redirect&url=http://dev.piwik.org/trac/ticket/502'>Click here.</a>", 
			'GeoIP' => "GeoIP plugin was disabled, because it is not compatible with the new Piwik 0.6. \nYou can download the latest version of the plugin, compatible with Piwik 0.6.\n<a target='_blank' href='?module=Proxy&action=redirect&url=http://dev.piwik.org/trac/ticket/45'>Click here.</a>"
		);
		$disabledPlugins = array();
		foreach($pluginsToDisableMessage as $pluginToDisable => $warningMessage) 
		{
			if(Piwik_PluginsManager::getInstance()->isPluginActivated($pluginToDisable))
			{
				Piwik_PluginsManager::getInstance()->deactivatePlugin($pluginToDisable);
				$disabledPlugins[] = $warningMessage;
			}
		}
		
		// Run the SQL
		Piwik_Updater::updateDatabase(__FILE__, self::getSql());
		
		// Outputs warning message, pointing users to the plugin download page
		if(!empty($disabledPlugins))
		{
			throw new Exception("The following plugins were disabled during the upgrade:"
							."<ul><li>" . 
								implode('</li><li>', $disabledPlugins) . 
							"</li></ul>");
		}
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:29,代码来源:0.6-rc1.php

示例6: worldMap

 function worldMap()
 {
     if (!Piwik_PluginsManager::getInstance()->isPluginActivated('UserCountry')) {
         return '';
     }
     $idSite = Piwik_Common::getRequestVar('idSite', 1, 'int');
     Piwik::checkUserHasViewAccess($idSite);
     $period = Piwik_Common::getRequestVar('period');
     $date = Piwik_Common::getRequestVar('date');
     $token_auth = Piwik::getCurrentUserTokenAuth();
     $view = Piwik_View::factory('worldmap');
     $view->dataUrl = "?module=API" . "&method=API.getProcessedReport&format=XML" . "&apiModule=UserCountry&apiAction=getCountry" . "&idSite=" . $idSite . "&period=" . $period . "&date=" . $date . "&token_auth=" . $token_auth . "&segment=" . Piwik_Common::unsanitizeInputValue(Piwik_Common::getRequestVar('segment', '')) . "&filter_limit=-1";
     // definition of the color scale
     $view->hueMin = 218;
     $view->hueMax = 216;
     $view->satMin = "0.285";
     $view->satMax = "0.9";
     $view->lgtMin = ".97";
     $view->lgtMax = ".44";
     $request = new Piwik_API_Request('method=API.getMetadata&format=PHP' . '&apiModule=UserCountry&apiAction=getCountry' . '&idSite=' . $idSite . '&period=' . $period . '&date=' . $date . '&token_auth=' . $token_auth . '&filter_limit=-1');
     $metaData = $request->process();
     $metrics = array();
     foreach ($metaData[0]['metrics'] as $id => $val) {
         if (Piwik_Common::getRequestVar('period') == 'day' || $id != 'nb_uniq_visitors') {
             $metrics[] = array($id, $val);
         }
     }
     foreach ($metaData[0]['processedMetrics'] as $id => $val) {
         $metrics[] = array($id, $val);
     }
     $view->metrics = $metrics;
     $view->defaultMetric = 'nb_visits';
     echo $view->render();
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:34,代码来源:Controller.php

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

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

示例9: activate

 function activate()
 {
     Piwik::checkUserIsSuperUser();
     $pluginName = Piwik_Common::getRequestVar('pluginName', null, 'string');
     Piwik_PluginsManager::getInstance()->activatePlugin($pluginName);
     Piwik_Url::redirectToUrl('index.php?module=CorePluginsAdmin');
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:7,代码来源:Controller.php

示例10: sendRequest

 protected function sendRequest($url, $method = 'GET', $data = null, $force = false)
 {
     // if doing a bulk request, store the url
     if ($this->doBulkRequests && !$force) {
         $this->storedTrackingActions[] = $url;
         return true;
     }
     if ($method == 'POST') {
         $requests = array();
         foreach ($this->storedTrackingActions as $action) {
             $requests[] = $this->parseUrl($action);
         }
         $testEnvironmentArgs = array();
     } else {
         $testEnvironmentArgs = $this->parseUrl($url);
         $requests = array($testEnvironmentArgs);
     }
     // unset cached values
     Piwik_Common::$trackerCache = null;
     Piwik_Tracker::setForceIp(null);
     Piwik_Tracker::setForceDateTime(null);
     Piwik_Tracker::setForceVisitorId(null);
     // save some values
     $plugins = Piwik_Config::getInstance()->Plugins['Plugins'];
     $pluginsTracker = Piwik_Config::getInstance()->Plugins_Tracker['Plugins_Tracker'];
     $oldTrackerConfig = Piwik_Config::getInstance()->Tracker;
     Piwik_PluginsManager::getInstance()->unloadPlugins();
     // modify config
     $GLOBALS['PIWIK_TRACKER_MODE'] = true;
     $GLOBALS['PIWIK_TRACKER_LOCAL_TRACKING'] = true;
     Piwik_Common::$initTrackerMode = false;
     Piwik_Tracker::setTestEnvironment($testEnvironmentArgs, $method);
     // set language
     $oldLang = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : '';
     $_SERVER['HTTP_ACCEPT_LANGUAGE'] = $this->acceptLanguage;
     // set user agent
     $oldUserAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
     $_SERVER['HTTP_USER_AGENT'] = $this->userAgent;
     // set cookie
     $oldCookie = $_COOKIE;
     parse_str(parse_url($this->requestCookie, PHP_URL_QUERY), $_COOKIE);
     // do tracking and capture output
     ob_start();
     $localTracker = new Piwik_Tracker();
     $localTracker->main($requests);
     $output = ob_get_contents();
     ob_end_clean();
     // restore vars
     Piwik_Config::getInstance()->Plugins_Tracker['Plugins_Tracker'] = $pluginsTracker;
     Piwik_Config::getInstance()->Tracker = $oldTrackerConfig;
     $_SERVER['HTTP_ACCEPT_LANGUAGE'] = $oldLang;
     $_SERVER['HTTP_USER_AGENT'] = $oldUserAgent;
     $_COOKIE = $oldCookie;
     $GLOBALS['PIWIK_TRACKER_LOCAL_TRACKING'] = false;
     $GLOBALS['PIWIK_TRACKER_MODE'] = false;
     unset($_GET['bots']);
     // reload plugins
     Piwik_PluginsManager::getInstance()->loadPlugins($plugins);
     return $output;
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:60,代码来源:LocalTracker.php

示例11: update

 static function update()
 {
     Piwik_Updater::updateDatabase(__FILE__, self::getSql());
     try {
         Piwik_PluginsManager::getInstance()->activatePlugin('Transitions');
     } catch (Exception $e) {
     }
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:8,代码来源:1.9-b19.php

示例12: getInstance

 /**
  * Returns the singleton Piwik_PluginsManager
  *
  * @return Piwik_PluginsManager
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         $c = __CLASS__;
         self::$instance = new $c();
     }
     return self::$instance;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:13,代码来源:PluginsManager.php

示例13: activate

 public function activate()
 {
     Piwik::checkUserIsSuperUser();
     $this->checkTokenInUrl();
     $pluginName = Piwik_Common::getRequestVar('pluginName', null, 'string');
     Piwik_PluginsManager::getInstance()->activatePlugin($pluginName);
     Piwik_Url::redirectToReferer();
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:8,代码来源:Controller.php

示例14: __construct

 function __construct()
 {
     parent::__construct();
     Piwik_Config::getInstance()->setTestEnvironment();
     Piwik_PluginsManager::getInstance()->unloadPlugins();
     Piwik_PluginsManager::getInstance()->loadPlugins(array('LanguagesManager'));
     $plugin = Piwik_PluginsManager::getInstance()->getLoadedPlugin('LanguagesManager');
     $plugin->install();
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:9,代码来源:UsersManager.test.php

示例15: setUp

 public function setUp()
 {
     parent::setUp();
     // setup the access layer
     $pseudoMockAccess = new FakeAccess();
     FakeAccess::$superUser = true;
     Zend_Registry::set('access', $pseudoMockAccess);
     Piwik_PluginsManager::getInstance()->loadPlugins(array('SitesManager'));
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:9,代码来源:VisitTest.php


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