diff options
author | Stefan Giehl <stefan@piwik.org> | 2017-09-26 01:28:40 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2017-09-26 01:28:40 +0300 |
commit | 9c8980844fbdd101975915597b72765e0ef2c7a2 (patch) | |
tree | de0968973e178de75835cb540444ece81392e0ce /plugins | |
parent | da6e68b04ff532d125e2c1e38be23814c5b8ecd9 (diff) |
Use mbstring proxy methods (#12104)
* Use mbstring proxy methods
* Avoid using strtolower/strtoupper if mbstring is not available to prevent possible unicode problems
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/API/ProcessedReport.php | 9 | ||||
-rw-r--r-- | plugins/Intl/Commands/GenerateIntl.php | 3 | ||||
-rw-r--r-- | plugins/MobileMessaging/SMSProvider.php | 3 | ||||
-rw-r--r-- | plugins/ScheduledReports/Controller.php | 5 |
4 files changed, 12 insertions, 8 deletions
diff --git a/plugins/API/ProcessedReport.php b/plugins/API/ProcessedReport.php index f498aa1432..360d6b7ddf 100644 --- a/plugins/API/ProcessedReport.php +++ b/plugins/API/ProcessedReport.php @@ -363,13 +363,14 @@ class ProcessedReport list($newReport, $columns, $rowsMetadata, $totals) = $this->handleTableReport($idSite, $dataTable, $reportMetadata, $showRawMetrics, $formatMetrics); - if (function_exists('mb_substr')) { + if (function_exists('mb_substr')) { foreach ($columns as &$name) { if (substr($name, 0, 1) === mb_substr($name, 0, 1)) { - $name = ucfirst($name); - } + $name = ucfirst($name); + } } - } + } + $website = new Site($idSite); $period = Period\Factory::build($period, $date); diff --git a/plugins/Intl/Commands/GenerateIntl.php b/plugins/Intl/Commands/GenerateIntl.php index 59b79ae30e..b525dda770 100644 --- a/plugins/Intl/Commands/GenerateIntl.php +++ b/plugins/Intl/Commands/GenerateIntl.php @@ -9,6 +9,7 @@ namespace Piwik\Plugins\Intl\Commands; +use Piwik\Common; use Piwik\Container\StaticContainer; use Piwik\Development; use Piwik\Filesystem; @@ -51,7 +52,7 @@ class GenerateIntl extends ConsoleCommand } preg_match_all("~^(.)(.*)$~u", $str, $arr); - return mb_strtoupper($arr[1][0], 'UTF-8').$arr[2][0]; + return Common::mb_strtoupper($arr[1][0]).$arr[2][0]; } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/plugins/MobileMessaging/SMSProvider.php b/plugins/MobileMessaging/SMSProvider.php index 8d6818f6e5..0675212fdc 100644 --- a/plugins/MobileMessaging/SMSProvider.php +++ b/plugins/MobileMessaging/SMSProvider.php @@ -8,6 +8,7 @@ */ namespace Piwik\Plugins\MobileMessaging; +use Piwik\Common; use Piwik\Container\StaticContainer; use Piwik\Plugin; use Piwik\Piwik; @@ -213,7 +214,7 @@ abstract class SMSProvider private static function sizeOfSMSContent($smsContent, $containsUCS2Chars) { - if ($containsUCS2Chars) return mb_strlen($smsContent, 'UTF-8'); + if ($containsUCS2Chars) return Common::mb_strlen($smsContent); $sizeOfSMSContent = 0; foreach (self::mb_str_split($smsContent) as $char) { diff --git a/plugins/ScheduledReports/Controller.php b/plugins/ScheduledReports/Controller.php index 789b30fbc4..b41159f907 100644 --- a/plugins/ScheduledReports/Controller.php +++ b/plugins/ScheduledReports/Controller.php @@ -8,6 +8,7 @@ */ namespace Piwik\Plugins\ScheduledReports; +use Piwik\Common; use Piwik\Date; use Piwik\Piwik; use Piwik\Plugins\LanguagesManager\LanguagesManager; @@ -36,7 +37,7 @@ class Controller extends \Piwik\Plugin\Controller $reportTypes = API::getReportTypes(); $reportTypeOptions = array(); foreach ($reportTypes as $reportType => $icon) { - $reportTypeOptions[$reportType] = mb_strtoupper($reportType); + $reportTypeOptions[$reportType] = Common::mb_strtoupper($reportType); } $view->reportTypes = $reportTypes; $view->reportTypeOptions = $reportTypeOptions; @@ -53,7 +54,7 @@ class Controller extends \Piwik\Plugin\Controller $reportFormatsByReportType[$reportType] = API::getReportFormats($reportType); $reportFormatsByReportTypeOptions[$reportType] = $reportFormatsByReportType[$reportType]; foreach ($reportFormatsByReportTypeOptions[$reportType] as $type => $icon) { - $reportFormatsByReportTypeOptions[$reportType][$type] = mb_strtoupper($type); + $reportFormatsByReportTypeOptions[$reportType][$type] = Common::mb_strtoupper($type); } $allowMultipleReportsByReportType[$reportType] = API::allowMultipleReports($reportType); |