This file is indexed.

/usr/share/php/Horde/CssMinify/CssParser.php is in php-horde-cssminify 1.0.2-4build1.

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
<?php
/**
 * Copyright 2014 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 Horde LLC
 * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
 * @package   CssMinify
 */

/**
 * CSS minification driver implemented by using the Horde/Css_Parse library.
 *
 * @author    Michael Slusarz <slusarz@horde.org>
 * @category  Horde
 * @copyright 2014 Horde LLC
 * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
 * @package   CssMinify
 */
class Horde_CssMinify_CssParser extends Horde_CssMinify
{
    /**
     * @param array $opts  Driver specific options:
     * <pre>
     *   - dataurl: (callback) A callback function to convert a URI to a
     *              data URL. Takes one argument (URI) and returns the data
     *              URI to be used in the file.
     *   - import: (callback) A callback function to convert a URI to a
     *             pathname. Takes one argument (URI) and expects an array
     *             back with two elements (URI, filename).
     * </pre>
     */
    public function setOptions(array $opts = array())
    {
        parent::setOptions($opts);
    }

    /**
     */
    public function minify()
    {
        if (is_string($this->_data)) {
            $parser = new Horde_Css_Parser($this->_data);
            return $parser->compress();
        }

        return $this->_minify($this->_data);
    }

    /**
     */
    protected function _minify($data)
    {
        $out = '';

        foreach ($data as $uri => $file) {
            if (!is_readable($file)) {
                $this->_opts['logger']->log(
                    sprintf('Could not open CSS file %s.', $file),
                    Horde_Log::ERR
                );
                continue;
            }

            $css = file_get_contents($file);

            try {
                $parser = new Horde_Css_Parser($css);
            } catch (Exception $e) {
                /* If the CSS is broken, log error and output as-is. */
                $this->_opts['logger']->log($e, Horde_Log::ERR);
                $out .= $css;
                continue;
            }

            if (!empty($this->_opts['import'])) {
                foreach ($parser->doc->getContents() as $val) {
                    if ($val instanceof Sabberworm\CSS\Property\Import) {
                        $res = call_user_func($this->_opts['import'], dirname($uri) . '/' . $val->getLocation()->getURL()->getString());
                        $out .= $this->_minify(array($res[0] => $res[1]));
                        $parser->doc->remove($val);
                    }
                }
            }

            $url = array();
            foreach ($parser->doc->getAllRuleSets() as $val) {
                foreach ($val->getRules('background-') as $val2) {
                    $item = $val2->getValue();

                    if ($item instanceof Sabberworm\CSS\Value\URL) {
                        $url[] = $item;
                    } elseif ($item instanceof Sabberworm\CSS\Value\RuleValueList) {
                        foreach ($item->getListComponents() as $val3) {
                            if ($val3 instanceof Sabberworm\CSS\Value\URL) {
                                $url[] = $val3;
                            }
                        }
                    }
                }
            }

            foreach ($url as $val) {
                $url_ob = $val->getURL();
                $url_str = ltrim($url_ob->getString());

                if ((stripos($url_str, 'http') !== 0) &&
                    !Horde_Url_Data::isData($url_str)) {
                    $url_str = dirname($uri) . '/' . $url_str;
                    if (!empty($this->_opts['dataurl'])) {
                        $url_str = call_user_func($this->_opts['dataurl'], $url_str);
                    }
                }

                $url_ob->setString($url_str);
            }

            $out .= $parser->compress();
        }

        return $out;
    }

}