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

ScreenFormatter.php « Log « core - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a6326a126fb678f859418d50c4262bc2ad6531c8 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/**
 * Piwik - Open source web analytics
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 *
 * @category Piwik
 * @package Piwik
 */
namespace Piwik\Log;
use Piwik\SettingsServer;

/**
 *
 * @package Piwik
 * @subpackage Log
 */
class ScreenFormatter implements \Zend_Log_Formatter_Interface
{
    /**
     * Returns the formatted event array
     *
     * @param array $event
     * @return array
     */
    function formatEvent($event)
    {
        // no injection in error messages, backtrace when displayed on screen
        return array_map(array('Piwik\Common', 'sanitizeInputValue'), $event);
    }

    /**
     * Returns the formatted String
     *
     * @param string $string
     * @return string
     */
    function format($string)
    {
        return self::getFormattedString($string);
    }

    /**
     * Returns the formatted String
     *
     * @param string $string
     * @return string
     */
    static public function getFormattedString($string)
    {
        if (!SettingsServer::isPhpCliMode()) {
            @header('Content-Type: text/html; charset=utf-8');
        }
        return $string;
    }
}