update Piwik to version 2.16 (fixes #91)
This commit is contained in:
parent
296343bf3b
commit
d885a4baa9
5833 changed files with 418860 additions and 226988 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
|
|
@ -44,13 +44,20 @@ class API extends \Piwik\Plugin\API
|
|||
}
|
||||
|
||||
$body = sprintf("Feature: %s\nLike: %s\n", $featureName, $likeText, $message);
|
||||
if (!empty($message)) {
|
||||
$body .= sprintf("Feedback:\n%s\n", $message);
|
||||
} else {
|
||||
$body .= "No feedback\n";
|
||||
}
|
||||
|
||||
$this->sendMail($featureName, $body);
|
||||
$feedbackMessage = "";
|
||||
if (!empty($message) && $message != 'undefined') {
|
||||
$feedbackMessage = sprintf("Feedback:\n%s\n", trim($message));
|
||||
}
|
||||
$body .= $feedbackMessage ? $feedbackMessage : " \n";
|
||||
|
||||
$subject = sprintf("%s for %s %s",
|
||||
empty($like) ? "-1" : "+1",
|
||||
$featureName,
|
||||
empty($feedbackMessage) ? "" : "(w/ feedback)"
|
||||
);
|
||||
|
||||
$this->sendMail($subject, $body);
|
||||
}
|
||||
|
||||
private function sendMail($subject, $body)
|
||||
|
|
@ -71,38 +78,14 @@ class API extends \Piwik\Plugin\API
|
|||
@$mail->send();
|
||||
}
|
||||
|
||||
private function findTranslationKeyForFeatureName($featureName)
|
||||
{
|
||||
if (empty($GLOBALS['Piwik_translations'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($GLOBALS['Piwik_translations'] as $key => $translations) {
|
||||
$possibleKey = array_search($featureName, $translations);
|
||||
if (!empty($possibleKey)) {
|
||||
return $key . '_' . $possibleKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function getEnglishTranslationForFeatureName($featureName)
|
||||
{
|
||||
$loadedLanguage = Translate::getLanguageLoaded();
|
||||
|
||||
if ($loadedLanguage == 'en') {
|
||||
if (Translate::getLanguageLoaded() == 'en') {
|
||||
return $featureName;
|
||||
}
|
||||
|
||||
$translationKeyForFeature = $this->findTranslationKeyForFeatureName($featureName);
|
||||
$translationKeyForFeature = Translate::findTranslationKeyForTranslation($featureName);
|
||||
|
||||
if (!empty($translationKeyForFeature)) {
|
||||
Translate::reloadLanguage('en');
|
||||
|
||||
$featureName = Piwik::translate($translationKeyForFeature);
|
||||
Translate::reloadLanguage($loadedLanguage);
|
||||
return $featureName;
|
||||
}
|
||||
|
||||
return $featureName;
|
||||
return Piwik::translate($translationKeyForFeature, array(), 'en');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue