diff options
author | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-06-23 12:42:04 +0300 |
---|---|---|
committer | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-06-23 12:42:04 +0300 |
commit | a32f537a8a2fb39cd84bdb00103566ebc455b7f2 (patch) | |
tree | 1e78ebee428a174572d83586402440a98f565341 /core | |
parent | 0cf1ebcd980646952d230c72c701ff9eeec9b1ac (diff) | |
parent | 8e2275d567fda2804617dc0df22cc513dd9862ab (diff) |
Merge branch 'master' into popover-errors
Diffstat (limited to 'core')
-rw-r--r-- | core/API/Request.php | 2 | ||||
-rw-r--r-- | core/Console.php | 10 | ||||
-rw-r--r-- | core/Http.php | 9 | ||||
-rw-r--r-- | core/Metrics/Formatter.php | 2 | ||||
-rw-r--r-- | core/Period/Week.php | 2 | ||||
-rw-r--r-- | core/Plugin/Controller.php | 16 | ||||
-rw-r--r-- | core/Segment.php | 2 | ||||
-rw-r--r-- | core/Translation/Translator.php | 40 | ||||
-rw-r--r-- | core/Version.php | 2 | ||||
-rw-r--r-- | core/Visualization/Sparkline.php | 2 |
10 files changed, 41 insertions, 46 deletions
diff --git a/core/API/Request.php b/core/API/Request.php index bb0a323565..d9e1a723e3 100644 --- a/core/API/Request.php +++ b/core/API/Request.php @@ -94,7 +94,7 @@ class Request $defaultRequest['segment'] = $requestRaw['segment']; } - if (empty($defaultRequest['format_metrics'])) { + if (!isset($defaultRequest['format_metrics'])) { $defaultRequest['format_metrics'] = 'bc'; } } diff --git a/core/Console.php b/core/Console.php index 5a3ff2f541..6b0c59297f 100644 --- a/core/Console.php +++ b/core/Console.php @@ -26,12 +26,14 @@ class Console extends Application */ private $environment; - public function __construct() + public function __construct(Environment $environment = null) { $this->setServerArgsIfPhpCgi(); parent::__construct(); + $this->environment = $environment; + $option = new InputOption('piwik-domain', null, InputOption::VALUE_OPTIONAL, @@ -169,8 +171,10 @@ class Console extends Application protected function initEnvironment(OutputInterface $output) { try { - $this->environment = new Environment('cli'); - $this->environment->init(); + if ($this->environment === null) { + $this->environment = new Environment('cli'); + $this->environment->init(); + } $config = Config::getInstance(); return $config; diff --git a/core/Http.php b/core/Http.php index 91956c9f29..e14cd952aa 100644 --- a/core/Http.php +++ b/core/Http.php @@ -548,7 +548,14 @@ class Http // redirects are included in the output html, so we look for the last line that starts w/ HTTP/... // to split the response while (substr($response, 0, 5) == "HTTP/") { - list($header, $response) = explode("\r\n\r\n", $response, 2); + $split = explode("\r\n\r\n", $response, 2); + + if(count($split) == 2) { + list($header, $response) = $split; + } else { + $response = ''; + $header = $split; + } } foreach (explode("\r\n", $header) as $line) { diff --git a/core/Metrics/Formatter.php b/core/Metrics/Formatter.php index 0e54dd959b..c2b8a1062d 100644 --- a/core/Metrics/Formatter.php +++ b/core/Metrics/Formatter.php @@ -109,7 +109,7 @@ class Formatter } elseif ($minutes > 0) { $return = sprintf(Piwik::translate('General_MinutesSeconds'), $minutes, $seconds); } else { - $return = sprintf(Piwik::translate('General_Seconds'), $seconds); + $return = sprintf(Piwik::translate('Intl_NSecondsShort'), $seconds); } if ($isNegative) { diff --git a/core/Period/Week.php b/core/Period/Week.php index a8af2fbed8..60b1af2ce6 100644 --- a/core/Period/Week.php +++ b/core/Period/Week.php @@ -43,7 +43,7 @@ class Week extends Period $format = $this->translator->translate('CoreHome_LongWeekFormat'); $string = self::getTranslatedRange($format, $this->getDateStart(), $this->getDateEnd()); - return $this->translator->translate('CoreHome_PeriodWeek') . " " . $string; + return $this->translator->translate('Intl_PeriodWeek') . " " . $string; } /** diff --git a/core/Plugin/Controller.php b/core/Plugin/Controller.php index 3e710608eb..c23044d2c2 100644 --- a/core/Plugin/Controller.php +++ b/core/Plugin/Controller.php @@ -199,20 +199,20 @@ abstract class Controller $availablePeriods = self::getEnabledPeriodsInUI(); $periodNames = array( 'day' => array( - 'singular' => Piwik::translate('CoreHome_PeriodDay'), - 'plural' => Piwik::translate('CoreHome_PeriodDays') + 'singular' => Piwik::translate('Intl_PeriodDay'), + 'plural' => Piwik::translate('Intl_PeriodDays') ), 'week' => array( - 'singular' => Piwik::translate('CoreHome_PeriodWeek'), - 'plural' => Piwik::translate('CoreHome_PeriodWeeks') + 'singular' => Piwik::translate('Intl_PeriodWeek'), + 'plural' => Piwik::translate('Intl_PeriodWeeks') ), 'month' => array( - 'singular' => Piwik::translate('CoreHome_PeriodMonth'), - 'plural' => Piwik::translate('CoreHome_PeriodMonths') + 'singular' => Piwik::translate('Intl_PeriodMonth'), + 'plural' => Piwik::translate('Intl_PeriodMonths') ), 'year' => array( - 'singular' => Piwik::translate('CoreHome_PeriodYear'), - 'plural' => Piwik::translate('CoreHome_PeriodYears') + 'singular' => Piwik::translate('Intl_PeriodYear'), + 'plural' => Piwik::translate('Intl_PeriodYears') ), // Note: plural is not used for date range 'range' => array( diff --git a/core/Segment.php b/core/Segment.php index 479492fb93..14e9230bfc 100644 --- a/core/Segment.php +++ b/core/Segment.php @@ -166,7 +166,7 @@ class Segment if (isset($segment['permission']) && $segment['permission'] != 1 ) { - throw new Exception("You do not have enough permission to access the segment " . $name); + throw new NoAccessException("You do not have enough permission to access the segment " . $name); } if ($matchType != SegmentExpression::MATCH_IS_NOT_NULL_NOR_EMPTY diff --git a/core/Translation/Translator.php b/core/Translation/Translator.php index 9dfc610c8d..af2ae597f2 100644 --- a/core/Translation/Translator.php +++ b/core/Translation/Translator.php @@ -28,34 +28,6 @@ class Translator private $translations = array(); /** - * Contains the already loaded country name translations - * - * @var array - */ - protected $loadedCountryTranslations = array(); - - /** - * Contains the already loaded continent name translations - * - * @var array - */ - protected $loadedContinentTranslations = array(); - - /** - * Contains the already loaded language name translations - * - * @var array - */ - private $loadedLanguageTranslations = array(); - - /** - * Contains the already loaded calendar translations - * - * @var array - */ - private $loadedCalendarTranslations = array(); - - /** * @var string */ private $currentLanguage; @@ -268,6 +240,18 @@ class Translator return $this->translations[$lang][$plugin][$key]; } + /** + * Fallback for keys moved to new Intl plugin to avoid untranslated string in non core plugins + * @todo remove this in Piwik 3.0 + */ + if ($plugin != 'Intl') { + if (isset($this->translations[$lang]['Intl']) + && isset($this->translations[$lang]['Intl'][$key]) + ) { + return $this->translations[$lang]['Intl'][$key]; + } + } + // fallback if ($lang !== $this->fallback) { return $this->getTranslation($id, $this->fallback, $plugin, $key); diff --git a/core/Version.php b/core/Version.php index 381450532c..15762a31e8 100644 --- a/core/Version.php +++ b/core/Version.php @@ -20,7 +20,7 @@ final class Version * The current Piwik version. * @var string */ - const VERSION = '2.14.0-b7'; + const VERSION = '2.14.0-b8'; public function isStableVersion($version) { diff --git a/core/Visualization/Sparkline.php b/core/Visualization/Sparkline.php index 642c1325cb..a4d3c6feed 100644 --- a/core/Visualization/Sparkline.php +++ b/core/Visualization/Sparkline.php @@ -109,7 +109,7 @@ class Sparkline implements ViewInterface $min = $max = $last = null; $i = 0; - $seconds = Piwik::translate('General_Seconds'); + $seconds = Piwik::translate('Intl_NSecondsShort'); $toRemove = array('%', str_replace('%s', '', $seconds)); foreach ($this->values as $value) { |