Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

language_file_helper.php

Zuletzt modifiziert: 01.05.2026, 11:25 - Dateigröße: 1.75 KiB


 01  <?php
 02  /**
 03   *
 04   * This file is part of the phpBB Forum Software package.
 05   *
 06   * @copyright (c) phpBB Limited <https://www.phpbb.com>
 07   * @license GNU General Public License, version 2 (GPL-2.0)
 08   *
 09   * 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          usort($available_languages, [$this, 'sort_by_local_name']);
 71   
 72          return $available_languages;
 73      }
 74   
 75      /**
 76       * Sorts the languages by their name instead of iso code
 77       *
 78       * @param mixed $a First language data
 79       * @param mixed $b Second language data
 80       * @return int
 81       */
 82      private static function sort_by_local_name($a, $b): int
 83      {
 84          return $a['local_name'] <=> $b['local_name'];
 85      }
 86  }
 87