Welcome to mirror list, hosted at ThFree Co, Russian Federation.

HtmlPreFormatter.php « Formatter « Log « core - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 878304e8fa166a5d588604965fe5f9353a1d6ea2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/**
 * Piwik - free/libre analytics platform
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */

namespace Piwik\Log\Formatter;

use Piwik\Common;
use Piwik\Log;

/**
 * Formats the message into `<pre></pre>` HTML tags.
 */
class HtmlPreFormatter extends Formatter
{
    public function format(array $record)
    {
        $record = $this->next($record);

        if (! is_string($record['message'])) {
            return $record;
        }

        if (!Common::isPhpCliMode()) {
            $record['message'] = '<pre>' . Common::sanitizeInputValue($record['message']) . '</pre>';
        }

        return $record;
    }
}