This file is indexed.

/usr/share/php/Icinga/Web/Menu/BadgeMenuItemRenderer.php is in php-icinga 2.1.0-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
58
59
60
61
62
63
64
65
66
<?php

namespace Icinga\Web\Menu;

use Icinga\Web\Menu;

abstract class BadgeMenuItemRenderer extends MenuItemRenderer
{
    const STATE_OK       = 'ok';
    const STATE_CRITICAL = 'critical';
    const STATE_WARNING  = 'warning';
    const STATE_PENDING  = 'pending';
    const STATE_UNKNOWN  = 'unknown';

    /**
     * Defines the color of the badge
     *
     * @return string
     */
    abstract public function getState();

    /**
     * The amount of items to display in the badge
     *
     * @return int
     */
    abstract public function getCount();

    /**
     * The tooltip title
     *
     * @return string
     */
    abstract public function getTitle();

    /**
     * Renders the html content of a single menu item
     *
     * @param Menu $menu
     *
     * @return string
     */
    public function render(Menu $menu)
    {
        return '<div class="clearfix">' . $this->renderBadge() . $this->createLink($menu) . '</div>';
    }

    /**
     * Render the badge
     *
     * @return string
     */
    protected function renderBadge()
    {
        if ($count = $this->getCount()) {
            $view = $this->getView();
            return sprintf(
                '<span title="%s" class="badge pull-right state-%s">%s</span>',
                $view->escape($this->getTitle()),
                $view->escape($this->getState()),
                $count
            );
        }
        return '';
    }
}