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


PHP Piwik_TranslateException函数代码示例

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


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

示例1: buildView

 protected function buildView()
 {
     // access control
     $idSite = Piwik_Common::getRequestVar('idSite', 1, 'int');
     Piwik_API_Request::reloadAuthUsingTokenAuth();
     if (!Piwik::isUserHasViewAccess($idSite)) {
         throw new Exception(Piwik_TranslateException('General_ExceptionPrivilegeAccessWebsite', array("'view'", $idSite)));
     }
     // collect data
     $this->parametersToModify['action'] = $this->currentControllerAction;
     $this->parametersToModify = array_merge($this->variablesDefault, $this->parametersToModify);
     $this->graphData = $this->getGraphData();
     // build view
     $view = new Piwik_View($this->dataTableTemplate);
     $view->width = $this->width;
     $view->height = $this->height;
     $view->chartDivId = $this->getUniqueIdViewDataTable() . "Chart";
     $view->graphType = $this->graphType;
     $view->data = $this->graphData;
     $view->isDataAvailable = strpos($this->graphData, '"series":[]') === false;
     $view->javascriptVariablesToSet = $this->getJavascriptVariablesToSet();
     $view->properties = $this->getViewProperties();
     $view->reportDocumentation = $this->getReportDocumentation();
     return $view;
 }
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:25,代码来源:GenerateGraphHTML.php

示例2: sendFeedback

 /**
  * send email to Piwik team and display nice thanks
  */
 function sendFeedback()
 {
     $email = Piwik_Common::getRequestVar('email', '', 'string');
     $body = Piwik_Common::getRequestVar('body', '', 'string');
     $category = Piwik_Common::getRequestVar('category', '', 'string');
     $nonce = Piwik_Common::getRequestVar('nonce', '', 'string');
     $view = Piwik_View::factory('sent');
     $view->feedbackEmailAddress = Zend_Registry::get('config')->General->feedback_email_address;
     try {
         $minimumBodyLength = 35;
         if (strlen($body) < $minimumBodyLength) {
             throw new Exception(Piwik_TranslateException('Feedback_ExceptionBodyLength', array($minimumBodyLength)));
         }
         if (!Piwik::isValidEmailString($email)) {
             throw new Exception(Piwik_TranslateException('UsersManager_ExceptionInvalidEmail'));
         }
         if (preg_match('/https?:/i', $body)) {
             throw new Exception(Piwik_TranslateException('Feedback_ExceptionNoUrls'));
         }
         if (!Piwik_Nonce::verifyNonce('Piwik_Feedback.sendFeedback', $nonce)) {
             throw new Exception(Piwik_TranslateException('General_ExceptionNonceMismatch'));
         }
         Piwik_Nonce::discardNonce('Piwik_Feedback.sendFeedback');
         $mail = new Piwik_Mail();
         $mail->setFrom(Piwik_Common::unsanitizeInputValue($email));
         $mail->addTo($view->feedbackEmailAddress, 'Piwik Team');
         $mail->setSubject('[ Feedback form - Piwik ] ' . $category);
         $mail->setBodyText(Piwik_Common::unsanitizeInputValue($body) . "\n" . 'Piwik ' . Piwik_Version::VERSION . "\n" . 'IP: ' . Piwik_Common::getIpString() . "\n" . 'URL: ' . Piwik_Url::getReferer() . "\n");
         @$mail->send();
     } catch (Exception $e) {
         $view->ErrorString = $e->getMessage();
         $view->message = $body;
     }
     echo $view->render();
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:38,代码来源:Controller.php

示例3: factory

 /**
  * Returns a Piwik_Date objects.
  *
  * @param string $strDate 'today' 'yesterday' or any YYYY-MM-DD or timestamp
  * @param string $timezone if specified, the dateString will be relative to this $timezone.
  * 				For example, today in UTC+12 will be a timestamp in the future for UTC.
  *              This is different from using ->setTimezone()
  * @return Piwik_Date
  */
 public static function factory($dateString, $timezone = null)
 {
     $invalidDateException = new Exception(Piwik_TranslateException('General_ExceptionInvalidDateFormat', array("YYYY-MM-DD, or 'today' or 'yesterday'", "strtotime", "http://php.net/strtotime")));
     if ($dateString instanceof self) {
         $dateString = $dateString->toString();
     }
     if ($dateString == 'now') {
         $date = self::now();
     } elseif ($dateString == 'today') {
         $date = self::today();
     } elseif ($dateString == 'yesterday') {
         $date = self::yesterday();
     } elseif ($dateString == 'yesterdaySameTime') {
         $date = self::yesterdaySameTime();
     } elseif (!is_int($dateString) && (strpos($dateString, ',') !== false || ($dateString = strtotime($dateString)) === false)) {
         throw $invalidDateException;
     } else {
         $date = new Piwik_Date($dateString);
     }
     $timestamp = $date->getTimestamp();
     // can't be doing web analytics before the 1st website
     if ($timestamp < 681436800) {
         throw $invalidDateException;
     }
     if (empty($timezone)) {
         return $date;
     }
     $timestamp = self::adjustForTimezone($timestamp, $timezone);
     return Piwik_Date::factory($timestamp);
 }
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:39,代码来源:Date.php

示例4: buildView

 protected function buildView()
 {
     $view = new Piwik_View($this->dataTableTemplate);
     $this->uniqueIdViewDataTable = $this->getUniqueIdViewDataTable();
     $view->graphType = $this->graphType;
     $this->chartDivId = $this->uniqueIdViewDataTable . "Chart_swf";
     $this->parametersToModify['action'] = $this->currentControllerAction;
     $this->parametersToModify = array_merge($this->variablesDefault, $this->parametersToModify);
     $url = Piwik_Url::getCurrentQueryStringWithParametersModified($this->parametersToModify);
     $this->includeData = !Zend_Registry::get('config')->Debug->disable_merged_requests;
     $idSite = Piwik_Common::getRequestVar('idSite', 1, 'int');
     Piwik_API_Request::reloadAuthUsingTokenAuth();
     if (!Piwik::isUserHasViewAccess($idSite)) {
         throw new Exception(Piwik_TranslateException('General_ExceptionPrivilegeAccessWebsite', array("'view'", $idSite)));
     }
     if ($this->includeData) {
         $this->chartData = $this->getFlashData();
     } else {
         $this->chartData = null;
     }
     $view->flashParameters = $this->getFlashParameters();
     $view->urlGraphData = $url;
     $view->chartDivId = $this->chartDivId;
     $view->formEmbedId = "formEmbed" . $this->uniqueIdViewDataTable;
     $view->javascriptVariablesToSet = $this->getJavascriptVariablesToSet();
     $view->properties = $this->getViewProperties();
     return $view;
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:28,代码来源:GenerateGraphHTML.php

示例5: checkServerVersion

 /**
  * Check MySQL version
  */
 public function checkServerVersion()
 {
     $databaseVersion = $this->getServerVersion();
     $requiredVersion = Zend_Registry::get('config')->General->minimum_mysql_version;
     if (version_compare($databaseVersion, $requiredVersion) === -1) {
         throw new Exception(Piwik_TranslateException('Core_ExceptionDatabaseVersion', array('MySQL', $databaseVersion, $requiredVersion)));
     }
 }
开发者ID:ntulip,项目名称:piwik,代码行数:11,代码来源:Mysqli.php

示例6: checkClientVersion

 /**
  * Check client version compatibility against database server
  */
 public function checkClientVersion()
 {
     $serverVersion = $this->getServerVersion();
     $clientVersion = $this->getClientVersion();
     if (version_compare($serverVersion, '5') >= 0 && version_compare($clientVersion, '5') < 0) {
         throw new Exception(Piwik_TranslateException('General_ExceptionIncompatibleClientServerVersions', array('MySQL', $clientVersion, $serverVersion)));
     }
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:11,代码来源:Mysql.php

示例7: checkServerVersion

 /**
  * Check PostgreSQL version
  */
 public function checkServerVersion()
 {
     $databaseVersion = $this->getServerVersion();
     $requiredVersion = Piwik_Config::getInstance()->General['minimum_pgsql_version'];
     if (version_compare($databaseVersion, $requiredVersion) === -1) {
         throw new Exception(Piwik_TranslateException('General_ExceptionDatabaseVersion', array('PostgreSQL', $databaseVersion, $requiredVersion)));
     }
 }
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:11,代码来源:Pgsql.php

示例8: loadTranslation

 /**
  * Load translations from file
  *
  * @param string $lang ISO 639-1 alpha-2 language code
  * @throws Exception
  * @return array $translations Array of translations ( key => translated string )
  */
 public static function loadTranslation($lang)
 {
     $path = self::getTranslationPath($lang);
     if (!is_readable($path)) {
         throw new Exception(Piwik_TranslateException('General_ExceptionLanguageFileNotFound', array($lang)));
     }
     require $path;
     return $translations;
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:16,代码来源:TranslationWriter.php

示例9: checkClientVersion

 /**
  * Check client version compatibility against database server
  *
  * @throws Exception
  */
 public function checkClientVersion()
 {
     $serverVersion = $this->getServerVersion();
     $clientVersion = $this->getClientVersion();
     // incompatible change to DECIMAL implementation in 5.0.3
     if (version_compare($serverVersion, '5.0.3') >= 0 && version_compare($clientVersion, '5.0.3') < 0) {
         throw new Exception(Piwik_TranslateException('General_ExceptionIncompatibleClientServerVersions', array('MySQL', $clientVersion, $serverVersion)));
     }
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:14,代码来源:Mysqli.php

示例10: factory

	/**
	 * Returns a Piwik_Date objects.
	 *
	 * @param string $strDate 'today' 'yesterday' or any YYYY-MM-DD or timestamp
	 * @param string $timezone if specified, the dateString will be relative to this $timezone.
	 * 				For example, today in UTC+12 will be a timestamp in the future for UTC.
	 *              This is different from using ->setTimezone()
	 * @return Piwik_Date
	 */
	static public function factory($dateString, $timezone = null)
	{
		if($dateString instanceof self)
		{
			$dateString = $dateString->toString();
		}
		if($dateString == 'now')
		{
			$date = self::now();
		}
		elseif($dateString == 'today')
		{
			$date = self::today();
		}
		elseif($dateString == 'yesterday')
		{
			$date = self::yesterday();
		}
		elseif($dateString == 'yesterdaySameTime')
		{
			$date = self::yesterdaySameTime();
		}
		elseif (!is_int($dateString)
			&& (
				// strtotime returns the timestamp for April 1st for a date like 2011-04-01,today 
				// but we don't want this, as this is a date range and supposed to throw the exception
				strpos($dateString, ',') !== false
				|| 
				($dateString = strtotime($dateString)) === false
				))
		{
			throw new Exception(Piwik_TranslateException('General_ExceptionInvalidDateFormat', array("YYYY-MM-DD, or 'today' or 'yesterday'", "strtotime", "http://php.net/strtotime")));
		}
		else
		{
			$date = new Piwik_Date($dateString);
		}
		if(empty($timezone))
		{
			return $date;
		}

		// manually adjust for UTC timezones
		$utcOffset = self::extractUtcOffset($timezone);
		if($utcOffset !== false)
		{
			return $date->addHour($utcOffset);
		}

		date_default_timezone_set($timezone);
		$datetime = $date->getDatetime();
		date_default_timezone_set('UTC');

		$date = Piwik_Date::factory(strtotime($datetime));

		return $date;
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:66,代码来源:Date.php

示例11: update

 static function update()
 {
     $obsoleteFile = PIWIK_DOCUMENT_ROOT . '/libs/open-flash-chart/php-ofc-library/ofc_upload_image.php';
     if (file_exists($obsoleteFile)) {
         $rc = @unlink($obsoleteFile);
         if (!$rc) {
             throw new Exception(Piwik_TranslateException('General_ExceptionUndeletableFile', array($obsoleteFile)));
         }
     }
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:10,代码来源:0.4.4.php

示例12: factory

 /**
  * Return the StaticGraph according to the static graph type $graphType
  *
  * @throws exception If the static graph type is unknown
  * @param string $graphType
  * @return Piwik_ImageGraph_StaticGraph
  */
 public static function factory($graphType)
 {
     if (isset(self::$availableStaticGraphTypes[$graphType])) {
         $className = self::$availableStaticGraphTypes[$graphType];
         Piwik_Loader::loadClass($className);
         return new $className();
     } else {
         throw new Exception(Piwik_TranslateException('General_ExceptionInvalidStaticGraphType', array($graphType, implode(', ', self::getAvailableStaticGraphTypes()))));
     }
 }
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:17,代码来源:StaticGraph.php

示例13: loadTranslation

 private function loadTranslation($language)
 {
     $path = PIWIK_INCLUDE_PATH . '/lang/' . $language . '.php';
     if (!Piwik_Common::isValidFilename($language) || !is_readable($path)) {
         throw new Exception(Piwik_TranslateException('General_ExceptionLanguageFileNotFound', array($language)));
     }
     require $path;
     $this->mergeTranslationArray($translations);
     $this->setLocale();
     $this->loadedLanguage = $language;
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:11,代码来源:Translate.php

示例14: factory

 /**
  * Return the SMSProvider associated to the provider name $providerName
  *
  * @throws exception If the provider is unknown
  * @param string $providerName
  * @return Piwik_MobileMessaging_SMSProvider
  */
 public static function factory($providerName)
 {
     $name = ucfirst(strtolower($providerName));
     $className = 'Piwik_MobileMessaging_SMSProvider_' . $name;
     try {
         Piwik_Loader::loadClass($className);
         return new $className();
     } catch (Exception $e) {
         throw new Exception(Piwik_TranslateException('MobileMessaging_Exception_UnknownProvider', array($name, implode(', ', array_keys(self::$availableSMSProviders)))));
     }
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:18,代码来源:SMSProvider.php

示例15: factory

 /**
  * Return the ReportRenderer associated to the renderer type $rendererType
  *
  * @throws exception If the renderer is unknown
  * @param string $rendererType
  * @return Piwik_ReportRenderer
  */
 public static function factory($rendererType)
 {
     $name = ucfirst(strtolower($rendererType));
     $className = 'Piwik_ReportRenderer_' . $name;
     try {
         Piwik_Loader::loadClass($className);
         return new $className();
     } catch (Exception $e) {
         @header('Content-Type: text/html; charset=utf-8');
         throw new Exception(Piwik_TranslateException('General_ExceptionInvalidReportRendererFormat', array($name, implode(', ', self::$availableReportRenderers))));
     }
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:19,代码来源:ReportRenderer.php


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