| | 288 | /** |
| | 289 | * This function returns an associative array with all the php files that are |
| | 290 | * plugins and their plugin info. |
| | 291 | |
| | 292 | * Following the wordpress model (and code) we search for plugins in the plugins |
| | 293 | * directory and each subdirectory 1 level deep. |
| | 294 | */ |
| | 295 | function getPlugins() { |
| | 296 | |
| | 297 | $plugin_dir_files = array(); |
| | 298 | $rss_plugins = array(); |
| | 299 | $plugin_dir = '../' . RSS_PLUGINS_DIR; |
| | 300 | |
| | 301 | $d = @dir($plugin_dir); |
| | 302 | //Put all the *.php files in the plugin dir and 1 level below into $plugin_dir_files |
| | 303 | while (($file = $d->read()) !== false) { |
| | 304 | if ( $file != "CVS" && (substr($file,0,1) != ".")) { |
| | 305 | if(is_dir($plugin_dir . '/' . $file)) { |
| | 306 | $plugins_subdir = @dir($plugin_dir . '/' . $file); |
| | 307 | if ($plugins_subdir) { |
| | 308 | while(($subfile = $plugins_subdir->read()) !== false) { |
| | 309 | if ( preg_match('|^\.+$|', $subfile) ) { |
| | 310 | continue; |
| | 311 | } |
| | 312 | if ( preg_match('|\.php$|', $subfile) ) { |
| | 313 | $plugin_dir_files[] = "$file/$subfile"; |
| | 314 | } |
| | 315 | } |
| | 316 | } |
| | 317 | } else { |
| | 318 | if ( preg_match('|\.php$|', $file) ) { |
| | 319 | $plugin_dir_files[] = $file; |
| | 320 | } |
| | 321 | } |
| | 322 | } |
| | 323 | } |
| | 324 | |
| | 325 | // See which of the php files in $plugin_dir_files are really plugins |
| | 326 | foreach($plugin_dir_files as $plugin_dir_file) { |
| | 327 | $info = getPluginInfo($plugin_dir_file); |
| | 328 | if (count($info)){ |
| | 329 | $rss_plugins[$plugin_dir_file] = $info; |
| | 330 | } |
| | 331 | } |
| | 332 | |
| | 333 | //return an associative array with the plugin files and their info |
| | 334 | return $rss_plugins; |
| | 335 | } |