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


PHP Piwik_Common::getPathToPiwikRoot方法代码示例

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


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

示例1: getHeaderLogoUrl

 /**
  * Returns the url to header logo (~127x50px)
  *
  * @param bool $pathOnly If true, returns path relative to doc root. Otherwise, returns a URL.
  * @return string
  */
 public function getHeaderLogoUrl($pathOnly = false)
 {
     $logo = 'themes/default/images/logo-header.png';
     if (Piwik_Config::getInstance()->branding['use_custom_logo'] == 1 && file_exists(Piwik_Common::getPathToPiwikRoot() . '/themes/logo-header.png')) {
         $logo = 'themes/logo-header.png';
     }
     if (!$pathOnly) {
         return Piwik::getPiwikUrl() . $logo;
     }
     return Piwik_Common::getPathToPiwikRoot() . '/' . $logo;
 }
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:17,代码来源:API.php

示例2: paintReportTable

 private function paintReportTable()
 {
     //Color and font restoration
     $this->TCPDF->SetFillColor($this->tableBackgroundColor[0], $this->tableBackgroundColor[1], $this->tableBackgroundColor[2]);
     $this->TCPDF->SetTextColor($this->reportTextColor[0], $this->reportTextColor[1], $this->reportTextColor[2]);
     $this->TCPDF->SetFont('');
     $fill = false;
     $url = false;
     $leftSpacesBeforeLogo = str_repeat(' ', $this->leftSpacesBeforeLogo);
     $logoWidth = $this->logoWidth;
     $logoHeight = $this->logoHeight;
     $rowsMetadata = $this->reportRowsMetadata->getRows();
     // Draw a body of report table
     foreach ($this->report->getRows() as $rowId => $row) {
         $rowMetrics = $row->getColumns();
         $rowMetadata = isset($rowsMetadata[$rowId]) ? $rowsMetadata[$rowId]->getColumns() : array();
         if (isset($rowMetadata['url'])) {
             $url = $rowMetadata['url'];
         }
         foreach ($this->reportColumns as $columnId => $columnName) {
             // Label column
             if ($columnId == 'label') {
                 $isLogoDisplayable = isset($rowMetadata['logo']);
                 $text = '';
                 $posX = $this->TCPDF->GetX();
                 $posY = $this->TCPDF->GetY();
                 if (isset($rowMetrics[$columnId])) {
                     $text = substr($rowMetrics[$columnId], 0, $this->truncateAfter);
                     if ($isLogoDisplayable) {
                         $text = $leftSpacesBeforeLogo . $text;
                     }
                 }
                 $text = $this->formatText($text);
                 $this->TCPDF->Cell($this->labelCellWidth, $this->cellHeight, $text, 'LR', 0, 'L', $fill, $url);
                 if ($isLogoDisplayable) {
                     if (isset($rowMetadata['logoWidth'])) {
                         $logoWidth = $rowMetadata['logoWidth'];
                     }
                     if (isset($rowMetadata['logoHeight'])) {
                         $logoHeight = $rowMetadata['logoHeight'];
                     }
                     $restoreY = $this->TCPDF->getY();
                     $restoreX = $this->TCPDF->getX();
                     $this->TCPDF->SetY($posY);
                     $this->TCPDF->SetX($posX);
                     $topMargin = 1.3;
                     // Country flags are not very high, force a bigger top margin
                     if ($logoHeight < 16) {
                         $topMargin = 2;
                     }
                     $path = Piwik_Common::getPathToPiwikRoot() . "/" . $rowMetadata['logo'];
                     if (file_exists($path)) {
                         $this->TCPDF->Image($path, $posX + ($leftMargin = 2), $posY + $topMargin, $logoWidth / 4);
                     }
                     $this->TCPDF->SetXY($restoreX, $restoreY);
                 }
             } else {
                 // No value means 0
                 if (empty($rowMetrics[$columnId])) {
                     $rowMetrics[$columnId] = 0;
                 }
                 $this->TCPDF->Cell($this->cellWidth, $this->cellHeight, $rowMetrics[$columnId], 'LR', 0, 'L', $fill);
             }
         }
         $this->TCPDF->Ln();
         // Top/Bottom grey border for all cells
         $this->TCPDF->SetDrawColor($this->rowTopBottomBorder[0], $this->rowTopBottomBorder[1], $this->rowTopBottomBorder[2]);
         $this->TCPDF->Cell($this->totalWidth, 0, '', 'T');
         $this->setBorderColor();
         $this->TCPDF->Ln(0.2);
         $fill = !$fill;
     }
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:73,代码来源:Pdf.php

示例3: copy

 /**
  * Copy individual file from $source to $target.
  * 
  * @param string $source eg. './tmp/latest/index.php'
  * @param string $target eg. './index.php'
  * @param bool   $excludePhp
  * @return bool
  */
 public static function copy($source, $dest, $excludePhp = false)
 {
     static $phpExtensions = array('php', 'tpl');
     if ($excludePhp) {
         $path_parts = pathinfo($source);
         if (in_array($path_parts['extension'], $phpExtensions)) {
             return true;
         }
     }
     if (!@copy($source, $dest)) {
         @chmod($dest, 0755);
         if (!@copy($source, $dest)) {
             throw new Exception("\n\t\t\t\tError while copying file to <code>{$dest}</code>. <br />\n\t\t\t\tPlease check that the web server has enough permission to overwrite this file. <br/>\n\t\t\t\tFor example, on a linux server, if your apache user is www-data you can try to execute:<br>\n\t\t\t\t<code>chown -R www-data:www-data " . Piwik_Common::getPathToPiwikRoot() . "</code><br>\n\t\t\t\t<code>chmod -R 0755 " . Piwik_Common::getPathToPiwikRoot() . "</code><br>\n\t\t\t\t\t");
         }
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:25,代码来源:Piwik.php

示例4: copy

 /**
  * Copy individual file from $source to $target.
  *
  * @param string $source eg. './tmp/latest/index.php'
  * @param string $target eg. './index.php'
  * @param bool   $excludePhp
  * @return bool
  */
 public static function copy($source, $dest, $excludePhp = false)
 {
     static $phpExtensions = array('php', 'tpl');
     if ($excludePhp) {
         $path_parts = pathinfo($source);
         if (in_array($path_parts['extension'], $phpExtensions)) {
             return true;
         }
     }
     if (!@copy($source, $dest)) {
         @chmod($dest, 0755);
         if (!@copy($source, $dest)) {
             $message = "Error while creating/copying file to <code>{$dest}</code>. <br />" . self::getErrorMessageMissingPermissions(Piwik_Common::getPathToPiwikRoot());
             throw new Exception($message);
         }
     }
     return true;
 }
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:26,代码来源:Piwik.php

示例5: getDefaultDefaultConfigPath

 public static function getDefaultDefaultConfigPath()
 {
     return Piwik_Common::getPathToPiwikRoot() . '/config/global.ini.php';
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:4,代码来源:Config.php

示例6: doWelcomeUpdates

 private function doWelcomeUpdates($view, $componentsWithUpdateFile)
 {
     $view->new_piwik_version = Piwik_Version::VERSION;
     $view->commandUpgradePiwik = "<br /><code>php " . Piwik_Common::getPathToPiwikRoot() . "/index.php  -- \"module=CoreUpdater\" </code>";
     $pluginNamesToUpdate = array();
     $coreToUpdate = false;
     // handle case of existing database with no tables
     if (!Piwik::isInstalled()) {
         $this->errorMessages[] = Piwik_Translate('CoreUpdater_EmptyDatabaseError', Zend_Registry::get('config')->database->dbname);
         $this->coreError = true;
         $currentVersion = 'N/A';
     } else {
         $this->errorMessages = array();
         try {
             $currentVersion = Piwik_GetOption('version_core');
         } catch (Exception $e) {
             $currentVersion = '<= 0.2.9';
         }
         foreach ($componentsWithUpdateFile as $name => $filenames) {
             if ($name == 'core') {
                 $coreToUpdate = true;
             } else {
                 $pluginNamesToUpdate[] = $name;
             }
         }
     }
     // check file integrity
     $integrityInfo = Piwik::getFileIntegrityInformation();
     if (isset($integrityInfo[1])) {
         if ($integrityInfo[0] == false) {
             $this->warningMessages[] = '<b>' . Piwik_Translate('General_FileIntegrityWarningExplanation') . '</b>';
         }
         $this->warningMessages = array_merge($this->warningMessages, array_slice($integrityInfo, 1));
     }
     Piwik::deleteAllCacheOnUpdate();
     $view->coreError = $this->coreError;
     $view->warningMessages = $this->warningMessages;
     $view->errorMessages = $this->errorMessages;
     $view->current_piwik_version = $currentVersion;
     $view->pluginNamesToUpdate = $pluginNamesToUpdate;
     $view->coreToUpdate = $coreToUpdate;
     echo $view->render();
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:43,代码来源:Controller.php

示例7: getHeaderLogoUrl

 /**
  * Returns the url to header logo (~127x50px)
  *
  * @param bool $pathOnly If true, returns path relative to doc root. Otherwise, returns a URL.
  * @return string
  */
 public function getHeaderLogoUrl($pathOnly = false)
 {
     $logo = 'themes/default/images/logo-header.png';
     if (Zend_Registry::get('config')->branding->use_custom_logo == 1 && file_exists(Piwik_Common::getPathToPiwikRoot() . '/themes/logo-header.png')) {
         $logo = 'themes/logo-header.png';
     }
     if (!$pathOnly) {
         return Piwik::getPiwikUrl() . $logo;
     }
     return Piwik_Common::getPathToPiwikRoot() . '/' . $logo;
 }
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:17,代码来源:API.php

示例8: getLogoPath

 /**
  * Returns relative path to the application logo
  *
  * @return string Absolute path to application logo
  */
 public function getLogoPath()
 {
     return Piwik_Common::getPathToPiwikRoot() . '/themes/default/images/logo.png';
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:9,代码来源:Piwik.php

示例9: start

 /**
  * Start the session
  *
  * @param array|bool  $options  An array of configuration options; the auto-start (bool) setting is ignored
  * @return void
  */
 public static function start($options = false)
 {
     if (Piwik_Common::isPhpCliMode() || self::$sessionStarted || defined('PIWIK_ENABLE_SESSION_START') && !PIWIK_ENABLE_SESSION_START) {
         return;
     }
     self::$sessionStarted = true;
     // use cookies to store session id on the client side
     @ini_set('session.use_cookies', '1');
     // prevent attacks involving session ids passed in URLs
     @ini_set('session.use_only_cookies', '1');
     // advise browser that session cookie should only be sent over secure connection
     if (Piwik::isHttps()) {
         @ini_set('session.cookie_secure', '1');
     }
     // advise browser that session cookie should only be accessible through the HTTP protocol (i.e., not JavaScript)
     @ini_set('session.cookie_httponly', '1');
     // don't use the default: PHPSESSID
     $sessionName = defined('PIWIK_SESSION_NAME') ? PIWIK_SESSION_NAME : 'PIWIK_SESSID';
     @ini_set('session.name', $sessionName);
     // proxies may cause the referer check to fail and
     // incorrectly invalidate the session
     @ini_set('session.referer_check', '');
     $currentSaveHandler = ini_get('session.save_handler');
     $config = Piwik_Config::getInstance();
     if (self::isFileBasedSessions()) {
         // Note: this handler doesn't work well in load-balanced environments and may have a concurrency issue with locked session files
         // for "files", use our own folder to prevent local session file hijacking
         $sessionPath = PIWIK_USER_PATH . '/tmp/sessions';
         // We always call mkdir since it also chmods the directory which might help when permissions were reverted for some reasons
         Piwik_Common::mkdir($sessionPath);
         @ini_set('session.save_handler', 'files');
         @ini_set('session.save_path', $sessionPath);
     } else {
         if ($config->General['session_save_handler'] === 'dbtable' || in_array($currentSaveHandler, array('user', 'mm'))) {
             // We consider these to be misconfigurations, in that:
             // - user  - we can't verify that user-defined session handler functions have already been set via session_set_save_handler()
             // - mm    - this handler is not recommended, unsupported, not available for Windows, and has a potential concurrency issue
             $db = Zend_Registry::get('db');
             $config = array('name' => Piwik_Common::prefixTable('session'), 'primary' => 'id', 'modifiedColumn' => 'modified', 'dataColumn' => 'data', 'lifetimeColumn' => 'lifetime', 'db' => $db);
             $saveHandler = new Piwik_Session_SaveHandler_DbTable($config);
             if ($saveHandler) {
                 self::setSaveHandler($saveHandler);
             }
         }
     }
     // garbage collection may disabled by default (e.g., Debian)
     if (ini_get('session.gc_probability') == 0) {
         @ini_set('session.gc_probability', 1);
     }
     try {
         Zend_Session::start();
         register_shutdown_function(array('Zend_Session', 'writeClose'), true);
     } catch (Exception $e) {
         Piwik::log('Unable to start session: ' . $e->getMessage());
         $enableDbSessions = '';
         if (Piwik::isInstalled()) {
             $enableDbSessions = "<br/>If you still experience issues after trying these changes, \n\t\t\t            \t\t\twe recommend that you <a href='http://piwik.org/faq/how-to-install/#faq_133' target='_blank'>enable database session storage</a>.";
         }
         $message = 'Error: ' . Piwik_Translate('General_ExceptionUnableToStartSession') . ' ' . Piwik::getErrorMessageMissingPermissions(Piwik_Common::getPathToPiwikRoot() . '/tmp/sessions/') . $enableDbSessions . "\n<pre>Debug: the original error was \n" . $e->getMessage() . "</pre>";
         Piwik_ExitWithMessage($message);
     }
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:68,代码来源:Session.php

示例10: copy

 public static function copy($source, $dest)
 {
     if (!@copy($source, $dest)) {
         @chmod($dest, 0755);
         if (!@copy($source, $dest)) {
             throw new Exception("\n\t\t\t\tError while copying file to <code>{$dest}</code>. <br />\n\t\t\t\tPlease check that the web server has enough permission to overwrite this file. <br/>\n\t\t\t\tFor example, on a linux server, if your apache user is www-data you can try to execute:<br>\n\t\t\t\t<code>chown -R www-data:www-data " . Piwik_Common::getPathToPiwikRoot() . "</code><br>\n\t\t\t\t<code>chmod -R 0755 " . Piwik_Common::getPathToPiwikRoot() . "</code><br>\n\t\t\t\t\t");
         }
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:10,代码来源:Piwik.php

示例11: copy

	/**
	 * Copy individual file from $source to $target.
	 *
	 * @param string $source eg. './tmp/latest/index.php'
	 * @param string $target eg. './index.php'
	 * @param bool   $excludePhp
	 * @return bool
	 */
	static public function copy($source, $dest, $excludePhp=false)
	{
		static $phpExtensions = array('php', 'tpl');

		if($excludePhp)
		{
			$path_parts = pathinfo($source);
			if(in_array($path_parts['extension'], $phpExtensions))
			{
				return true;
			}
		}

		if(!@copy( $source, $dest ))
		{
			@chmod($dest, 0755);
	   		if(!@copy( $source, $dest ))
	   		{
				$message = "Error while copying file to <code>$dest</code>. <br />"
				         . "Please check that the web server has enough permission to overwrite this file. <br />";

				if(Piwik_Common::isWindows())
				{
					$message .= "On Windows, you can try to execute:<br />"
					          . "<code>cacls ".Piwik_Common::getPathToPiwikRoot()." /t /g ".get_current_user().":f</code><br />";
				}
				else
				{
					$message = "For example, on a Linux server, if your Apache httpd user is www-data you can try to execute:<br />"
					         . "<code>chown -R www-data:www-data ".Piwik_Common::getPathToPiwikRoot()."</code><br />"
					         . "<code>chmod -R 0755 ".Piwik_Common::getPathToPiwikRoot()."</code><br />";
				}
				throw new Exception($message);
	   		}
		}
		return true;
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:45,代码来源:Piwik.php

示例12: doWelcomeUpdates

	private function doWelcomeUpdates($view, $componentsWithUpdateFile)
	{
		$view->new_piwik_version = Piwik_Version::VERSION;
		$view->commandUpgradePiwik = "<br/><code>php ".Piwik_Common::getPathToPiwikRoot()."/index.php </code>";
		$pluginNamesToUpdate = array();
		$coreToUpdate = false;

		// handle case of existing database with no tables
		$tablesInstalled = Piwik::getTablesInstalled();
		if(count($tablesInstalled) == 0)
		{
			$this->errorMessages[] = Piwik_Translate('CoreUpdater_EmptyDatabaseError', Zend_Registry::get('config')->database->dbname);
			$this->coreError = true;
			$currentVersion = 'N/A';
		}
		else
		{
			$this->errorMessages = array();
			try {
				$currentVersion = Piwik_GetOption('version_core');
			} catch( Exception $e) {
				$currentVersion = '<= 0.2.9';
			}
	
			foreach($componentsWithUpdateFile as $name => $filenames)
			{
				if($name == 'core')
				{
					$coreToUpdate = true;
				}
				else
				{
					$pluginNamesToUpdate[] = $name;
				}
			}
		}
		$view->coreError = $this->coreError;
		$view->errorMessages = $this->errorMessages;
		$view->current_piwik_version = $currentVersion;
		$view->pluginNamesToUpdate = $pluginNamesToUpdate;
		$view->coreToUpdate = $coreToUpdate; 
		$view->clearCompiledTemplates();
		echo $view->render();
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:44,代码来源:Controller.php


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