Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

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

finder.php

Zuletzt modifiziert: 09.10.2024, 12:52 - Dateigröße: 1.72 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\hook;
 15   
 16  /**
 17  * The hook finder locates installed hooks.
 18  */
 19  class finder
 20  {
 21      protected $phpbb_root_path;
 22      protected $cache;
 23      protected $php_ext;
 24   
 25      /**
 26      * Creates a new finder instance.
 27      *
 28      * @param string $phpbb_root_path Path to the phpbb root directory
 29      * @param string $php_ext php file extension
 30      * @param \phpbb\cache\driver\driver_interface $cache A cache instance or null
 31      */
 32      public function __construct($phpbb_root_path, $php_ext, \phpbb\cache\driver\driver_interface $cache = null)
 33      {
 34          $this->phpbb_root_path = $phpbb_root_path;
 35          $this->cache = $cache;
 36          $this->php_ext = $php_ext;
 37      }
 38   
 39      /**
 40      * Finds all hook files.
 41      *
 42      * @param bool $cache Whether the result should be cached
 43      * @return array An array of paths to found hook files
 44      */
 45      public function find($cache = true)
 46      {
 47          if (!defined('DEBUG') && $cache && $this->cache)
 48          {
 49              $hook_files = $this->cache->get('_hooks');
 50              if ($hook_files !== false)
 51              {
 52                  return $hook_files;
 53              }
 54          }
 55   
 56          $hook_files = array();
 57   
 58          // Now search for hooks...
 59          $dh = @opendir($this->phpbb_root_path . 'includes/hooks/');
 60   
 61          if ($dh)
 62          {
 63              while (($file = readdir($dh)) !== false)
 64              {
 65                  if (strpos($file, 'hook_') === 0 && substr($file, -strlen('.' . $this->php_ext)) === '.' . $this->php_ext)
 66                  {
 67                      $hook_files[] = substr($file, 0, -(strlen($this->php_ext) + 1));
 68                  }
 69              }
 70              closedir($dh);
 71          }
 72   
 73          if ($cache && $this->cache)
 74          {
 75              $this->cache->put('_hooks', $hook_files);
 76          }
 77   
 78          return $hook_files;
 79      }
 80  }
 81