| @@ 140-161 (lines=22) @@ | ||
| 137 | * The starting directory is the directory where the class is (witch using trait) |
|
| 138 | * @param string $filePath |
|
| 139 | */ |
|
| 140 | public function import($filePath) { |
|
| 141 | $ext = strtolower(pathinfo($filePath, PATHINFO_EXTENSION)); |
|
| 142 | if ($ext != 'php' && $ext != '') { |
|
| 143 | return; |
|
| 144 | } |
|
| 145 | ||
| 146 | $filePath = str_replace('.php', '', $filePath); |
|
| 147 | $reflection = new ReflectionClass($this); |
|
| 148 | $workingDir = pathinfo($reflection->getFileName(), PATHINFO_DIRNAME); |
|
| 149 | $filePath = $workingDir . DIRECTORY_SEPARATOR . str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $filePath); |
|
| 150 | ||
| 151 | if (strpos($filePath, '*') === FALSE) { |
|
| 152 | include_once $filePath . EXT; |
|
| 153 | } else { |
|
| 154 | $filesOfDir = get_filenames(str_replace('*', '', $filePath), TRUE); |
|
| 155 | foreach ($filesOfDir as $file) { |
|
| 156 | if (strtolower(pathinfo($file, PATHINFO_EXTENSION)) == 'php') { |
|
| 157 | include_once str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $file); |
|
| 158 | } |
|
| 159 | } |
|
| 160 | } |
|
| 161 | } |
|
| 162 | ||
| 163 | /** |
|
| 164 | * Install module |
|
| @@ 223-244 (lines=22) @@ | ||
| 220 | * The starting directory is the directory where the class is (witch using trait) |
|
| 221 | * @param string $filePath |
|
| 222 | */ |
|
| 223 | public function import($filePath) { |
|
| 224 | $ext = strtolower(pathinfo($filePath, PATHINFO_EXTENSION)); |
|
| 225 | if ($ext != 'php' && $ext != '') { |
|
| 226 | return; |
|
| 227 | } |
|
| 228 | ||
| 229 | $filePath = str_replace('.php', '', $filePath); |
|
| 230 | $reflection = new ReflectionClass($this); |
|
| 231 | $workingDir = pathinfo($reflection->getFileName(), PATHINFO_DIRNAME); |
|
| 232 | $filePath = $workingDir . DIRECTORY_SEPARATOR . str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $filePath); |
|
| 233 | ||
| 234 | if (strpos($filePath, '*') === FALSE) { |
|
| 235 | include_once $filePath . EXT; |
|
| 236 | } else { |
|
| 237 | $filesOfDir = get_filenames(str_replace('*', '', $filePath), TRUE); |
|
| 238 | foreach ($filesOfDir as $file) { |
|
| 239 | if (strtolower(pathinfo($file, PATHINFO_EXTENSION)) == 'php') { |
|
| 240 | include_once str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $file); |
|
| 241 | } |
|
| 242 | } |
|
| 243 | } |
|
| 244 | } |
|
| 245 | ||
| 246 | } |
|