[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/phpbb/language/ -> language_file_helper.php (source)

   1  <?php
   2  /**
   3   *
   4   * This file is part of the phpBB Forum Software package.
   5   *
   6   * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7   * @license GNU General Public License, version 2 (GPL-2.0)
   8   *
   9   * For full copyright and license information, please see
  10   * the docs/CREDITS.txt file.
  11   *
  12   */
  13  
  14  namespace phpbb\language;
  15  
  16  use Symfony\Component\Finder\Finder;
  17  
  18  /**
  19   * Helper class for language file related functions
  20   */
  21  class language_file_helper
  22  {
  23      /**
  24       * @var string    Path to phpBB's root
  25       */
  26      protected $phpbb_root_path;
  27  
  28      /**
  29       * Constructor
  30       *
  31       * @param string    $phpbb_root_path    Path to phpBB's root
  32       */
  33  	public function __construct($phpbb_root_path)
  34      {
  35          $this->phpbb_root_path = $phpbb_root_path;
  36      }
  37  
  38      /**
  39       * Returns available languages
  40       *
  41       * @return array
  42       */
  43  	public function get_available_languages()
  44      {
  45          // Find available language packages
  46          $finder = new Finder();
  47          $finder->files()
  48              ->name('iso.txt')
  49              ->depth('== 1')
  50              ->followLinks()
  51              ->in($this->phpbb_root_path . 'language');
  52  
  53          $available_languages = array();
  54          foreach ($finder as $file)
  55          {
  56              $path = $file->getRelativePath();
  57              $info = explode("\n", $file->getContents());
  58  
  59              $available_languages[] = array(
  60                  // Get the name of the directory containing iso.txt
  61                  'iso' => $path,
  62  
  63                  // Recover data from file
  64                  'name' => trim($info[0]),
  65                  'local_name' => trim($info[1]),
  66                  'author' => trim($info[2])
  67              );
  68          }
  69  
  70          return $available_languages;
  71      }
  72  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1