Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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: 09.10.2024, 12:52 - Dateigröße: 1.41 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          return $available_languages;
 71      }
 72  }
 73