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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
finder.php
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 /**
22 * @var \phpbb\cache\driver\driver_interface
23 */
24 protected $cache;
25
26 /**
27 * @var string
28 */
29 protected $phpbb_root_path;
30
31 /**
32 * @var string
33 */
34 protected $php_ext;
35
36 /**
37 * Creates a new finder instance.
38 *
39 * @param string $phpbb_root_path Path to the phpbb root directory
40 * @param string $php_ext php file extension
41 * @param \phpbb\cache\driver\driver_interface $cache A cache instance or null
42 */
43 public function __construct($phpbb_root_path, $php_ext, \phpbb\cache\driver\driver_interface $cache = null)
44 {
45 $this->phpbb_root_path = $phpbb_root_path;
46 $this->cache = $cache;
47 $this->php_ext = $php_ext;
48 }
49
50 /**
51 * Finds all hook files.
52 *
53 * @param bool $cache Whether the result should be cached
54 * @return array An array of paths to found hook files
55 */
56 public function find($cache = true)
57 {
58 if (!defined('DEBUG') && $cache && $this->cache)
59 {
60 $hook_files = $this->cache->get('_hooks');
61 if ($hook_files !== false)
62 {
63 return $hook_files;
64 }
65 }
66
67 $hook_files = array();
68
69 // Now search for hooks...
70 $dh = @opendir($this->phpbb_root_path . 'includes/hooks/');
71
72 if ($dh)
73 {
74 while (($file = readdir($dh)) !== false)
75 {
76 if (strpos($file, 'hook_') === 0 && substr($file, -strlen('.' . $this->php_ext)) === '.' . $this->php_ext)
77 {
78 $hook_files[] = substr($file, 0, -(strlen($this->php_ext) + 1));
79 }
80 }
81 closedir($dh);
82 }
83
84 if ($cache && $this->cache)
85 {
86 $this->cache->put('_hooks', $hook_files);
87 }
88
89 return $hook_files;
90 }
91 }
92