This file is indexed.

/usr/share/php/Horde/Translation/Autodetect.php is in php-horde-translation 2.2.1-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
 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
<?php
/**
 * Copyright 2010-2016 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 2010-2016 Horde LLC
 * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
 * @package   Translation
 * @since     2.2.0
 */

/**
 * The Horde_Translation_Autodetect auto detects the locale directory location
 * for the class implementing it.
 *
 * @author    Jan Schneider <jan@horde.org>
 * @category  Horde
 * @copyright 2010-2016 Horde LLC
 * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
 * @package   Translation
 * @since     2.2.0
 */
abstract class Horde_Translation_Autodetect extends Horde_Translation
{
    /**
     * The absolute PEAR path to the translations for the default gettext handler.
     *
     * This value is automatically set by PEAR Replace Tasks.
     *
     * @var string
     */
    protected static $_pearDirectory;

    /**
     * Auto detects the locale directory location.
     *
     * @param string $handlerClass  The name of a class implementing the
     *                              Horde_Translation_Handler interface.
     */
    public static function loadHandler($handlerClass)
    {
        if (!static::$_domain) {
            throw new Horde_Translation_Exception('The domain property must be set by the class that extends Horde_Translation_Autodetect.');
        }

        $directory = static::_searchLocaleDirectory();
        if (!$directory) {
            throw new Horde_Translation_Exception(sprintf('Could not found find any locale directory for %s domain.', static::$_domain));
        }

        static::$_directory = $directory;
        parent::loadHandler($handlerClass);
    }

    /**
     * Search for the locale directory for different installations methods (eg: PEAR, Composer).
     *
     * @var boolean|string The directory if found, or false when no valid directory is found
     */
    protected static function _searchLocaleDirectory()
    {
        if (static::$_pearDirectory !== '@data_dir@') {
            $directory = static::$_pearDirectory . '/' . static::$_domain . '/locale';
            if (file_exists($directory)) {
                return $directory;
            }
        }

        $directories = static::_getSearchDirectories();
        foreach ($directories as $directory) {
            if (file_exists($directory)) {
                return $directory;
            }
        }

        return false;
    }

    /**
     * Get potential locations for the locale directory.
     *
     * @var array List of directories
     */
    protected static function _getSearchDirectories()
    {
        $className = get_called_class();
        $class = new ReflectionClass($className);
        $basedir = dirname($class->getFilename());
        $depth = substr_count($className, '_');

        return array(
            /* Composer */
            $basedir . str_repeat('/..', $depth) . '/data/locale',
            /* Source */
            $basedir . str_repeat('/..', $depth + 1) . '/locale'
        );
    }

}