| | 114 | } |
|---|
| | 115 | |
|---|
| | 116 | /** |
|---|
| | 117 | * Returns a list of all the plugins either currently loaded or within the |
|---|
| | 118 | * plugin directory. |
|---|
| | 119 | * |
|---|
| | 120 | * @param $plugin $dirList If true, scan the Plugin directory for the list |
|---|
| | 121 | * @return array |
|---|
| | 122 | */ |
|---|
| | 123 | public function getPluginList($dirList = false, $preserveExt = false) |
|---|
| | 124 | { |
|---|
| | 125 | if (!$dirList) { |
|---|
| | 126 | return array_keys($this->plugins); |
|---|
| | 127 | } else { |
|---|
| | 128 | $iterator = new DirectoryIterator(PHERGIE_DIR . '/Phergie/Plugin'); |
|---|
| | 129 | $plugins = array(); |
|---|
| | 130 | |
|---|
| | 131 | foreach ($iterator as $filename) { |
|---|
| | 132 | if ($iterator->isFile()) { |
|---|
| | 133 | $plugins[] = ($preserveExt ? (string) $filename : basename((string) $filename, '.php')); |
|---|
| | 134 | } |
|---|
| | 135 | } |
|---|
| | 136 | unset($iterator, $filename, $dirList); |
|---|
| | 137 | |
|---|
| | 138 | return $plugins; |
|---|
| | 139 | } |
|---|