PluginProbe
Age Gate / trunk
Age Gate vtrunk
trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 All 112 releases
age-gate / src / Integration / Discover.php

Discover.php in Age Gate trunk, at src/Integration/Discover.php

40 lines 877 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace AgeGate\Integration;
4
5 use RecursiveIteratorIterator;
6 use RecursiveDirectoryIterator;
7
8 class Discover
9 {
10 public function __construct()
11 {
12 $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(dirname(__FILE__)));
13
14 $files = [];
15
16 foreach ($rii as $file) {
17 if ($file->isDir()) {
18 continue;
19 }
20
21 $class = trim(str_replace($file->getExtension(), '', $file->getFilename()), '.');
22
23
24 $ns = 'AgeGate' . str_replace(AGE_GATE_PATH . 'src', '', $file->getPath()) . '/' . $class;
25
26 $class = str_replace('/', '\\', $ns);
27
28 if ($class === __CLASS__) {
29 continue;
30 }
31
32 if (class_exists($class)) {
33 (new $class)->init();
34 }
35
36 $files[] = $file->getPathname();
37 }
38 }
39 }
40