This file is indexed.

/usr/share/php/Horde/JavascriptMinify.php is in php-horde-javascriptminify 1.1.2-3build1.

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
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?php
/**
 * Copyright 2014-2015 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.horde.org/licenses/lgpl21.
 *
 * @category  Horde
 * @copyright 2014-2015 Horde LLC
 * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
 * @package   JavascriptMinify
 */

/**
 * Abstract base class for implementing a javascript minification driver.
 *
 * @author    Michael Slusarz <slusarz@horde.org>
 * @category  Horde
 * @copyright 2014-2015 Horde LLC
 * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
 * @package   JavascriptMinify
 */
abstract class Horde_JavascriptMinify
{
    /**
     * Original javascript data.
     *
     * @var mixed
     */
    protected $_data;

    /**
     * Minification options.
     *
     * @var array
     */
    protected $_opts = array();

    /**
     * Temporary file containing sourcemap data.
     *
     * @var string
     */
    protected $_sourcemap = null;

    /**
     * Constructor.
     *
     * @param mixed $js    Either a string (the JS text to compress) or an
     *                     array of URLs (keys) to filenames (values)
     *                     containing the JS data to compress.
     * @param array $opts  Additional options. See setOptions().
     */
    public function __construct($js, array $opts = array())
    {
        if (!is_array($js) && !is_string($js)) {
            throw new InvalidArgumentException('First argument must either be an array or a string.');
        }

        $this->_data = $js;
        $this->setOptions($opts);
    }

    /**
     * @see Horde_JavascriptMinify::minify()
     */
    public function __toString()
    {
        return $this->minify();
    }

    /**
     * Set minification options.
     *
     * @param array $opts  Options:
     * <pre>
     *   - logger: (Horde_Log_Logger) Log object to use for log messages.
     * </pre>
     */
    public function setOptions(array $opts = array())
    {
        $this->_opts = array_merge($this->_opts, $opts);

        // Ensure we have a logger object.
        if (!isset($this->_opts['logger']) ||
            !($this->_opts['logger'] instanceof Horde_Log_Logger)) {
            $this->_opts['logger'] = new Horde_Log_Logger(
                new Horde_Log_Handler_Null()
            );
        }
    }

    /**
     * Return the minified javascript.
     *
     * @return string  Minified javascript.
     * @throws Horde_JavascriptMinify_Exception
     */
    abstract public function minify();

    /**
     * Returns the sourcemap data.
     * Only supported if javascript is data is provided via web-accessible
     * static files.
     * minify() must be called before this method will return any data.
     *
     * @return mixed  The sourcemap data, or null if it doesn't exist.
     */
    public function sourcemap()
    {
        if (is_null($this->_sourcemap) ||
            !is_readable($this->_sourcemap) ||
            !strlen($sourcemap = file_get_contents($this->_sourcemap))) {
            return null;
        }

        /* Sourcemap data is JSON encoded. Need to grab 'sources', which
         * contains filenames, and convert to URLs. */
        $sourcemap = json_decode($sourcemap);
        $data_lookup = array_flip($this->_data);
        $new_sources = array();

        foreach ($sourcemap->sources as $val) {
            $new_sources[] = $data_lookup[$val];
        }

        $sourcemap->sources = $new_sources;
        unset($sourcemap->sourceRoot, $sourcemap->file);

        return json_encode($sourcemap);
    }

    /**
     * Creates a list of source comments linking to the original URLs of the
     * source files.
     *
     * Needed in minification files to ensure that all license terms of the
     * minified code (which may have been removed during the minification
     * process) are accessible.
     *
     * @since 1.1.0
     *
     * @return string  Source URL data.
     */
    protected function _sourceUrls()
    {
        $out = '';

        if (is_array($this->_data)) {
            foreach (array_keys($this->_data) as $val) {
                $out .= "\n// @source: " . $val;
            }
        }

        return $out;
    }

}