| 295 | | foreach ( $plugin_files as $plugin_file ) { |
| 296 | | if ( !is_readable( WPMU_PLUGIN_DIR . "/$plugin_file" ) ) |
| 297 | | continue; |
| 298 | | |
| 299 | | $plugin_data = get_plugin_data( WPMU_PLUGIN_DIR . "/$plugin_file", false, false ); //Do not apply markup/translate as it'll be cached. |
| 300 | | |
| 301 | | if ( empty ( $plugin_data['Name'] ) ) |
| 302 | | $plugin_data['Name'] = $plugin_file; |
| 303 | | |
| 304 | | $wp_plugins[ $plugin_file ] = $plugin_data; |
| 305 | | } |
| 306 | | |
| 307 | | if ( isset( $wp_plugins['index.php'] ) && filesize( WPMU_PLUGIN_DIR . '/index.php') <= 30 ) // silence is golden |
| 308 | | unset( $wp_plugins['index.php'] ); |
| 309 | | |
| 310 | | uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' )); |
| 311 | | |
| 312 | | return $wp_plugins; |
| | 296 | return _filter_plugins_by_dir( $plugin_files, WPMU_PLUGIN_DIR, true ); |
| 340 | | foreach ( $plugin_files as $plugin_file ) { |
| 341 | | if ( !is_readable( WP_CONTENT_DIR . "/$plugin_file" ) ) |
| 342 | | continue; |
| 343 | | $plugin_data = get_plugin_data( WP_CONTENT_DIR . "/$plugin_file", false, false ); //Do not apply markup/translate as it'll be cached. |
| 344 | | if ( empty ( $plugin_data['Name'] ) ) |
| 345 | | $plugin_data['Name'] = $plugin_file; |
| 346 | | $dropins[ $plugin_file ] = $plugin_data; |
| 347 | | } |
| 348 | | |
| 349 | | uksort( $dropins, create_function( '$a, $b', 'return strnatcasecmp( $a, $b );' )); |
| 350 | | |
| 351 | | return $dropins; |
| | 325 | return _filter_plugins_by_dir( $plugin_files, WP_CONTENT_DIR ); |
| | 359 | * filter plugins based on their folder |
| | 360 | * |
| | 361 | * used for mu-plugins, dropins |
| | 362 | * |
| | 363 | * @param array $plugins plugin filenames |
| | 364 | * @param string $folder folder to verify plugins in |
| | 365 | * @param bool $test_golden wether or not to test for a directory listing preventing 'silence is golden' (small) index.php file. |
| | 366 | * @return array filtered plugins |
| | 367 | */ |
| | 368 | function _filter_plugins_by_dir($plugin_files, $folder, $test_golden = false) { |
| | 369 | $wp_plugins = array(); |
| | 370 | |
| | 371 | foreach ( $plugin_files as $plugin_file ) { |
| | 372 | $plugin_path = $folder . '/' . $plugin_file; |
| | 373 | if ( !is_readable( $plugin_path ) ) |
| | 374 | continue; |
| | 375 | |
| | 376 | if ( $test_golden && 'index.php' == $plugin_file && filesize( $plugin_path ) <= 30 ) // silence is golden |
| | 377 | continue; |
| | 378 | |
| | 379 | $plugin_data = get_plugin_data( $plugin_path, false, false ); //Do not apply markup/translate as it'll be cached. |
| | 380 | |
| | 381 | if ( empty ( $plugin_data['Name'] ) ) |
| | 382 | $plugin_data['Name'] = $plugin_file; |
| | 383 | |
| | 384 | $wp_plugins[ $plugin_file ] = $plugin_data; |
| | 385 | } |
| | 386 | |
| | 387 | uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' )); |
| | 388 | |
| | 389 | return $wp_plugins; |
| | 390 | } |
| | 391 | |
| | 392 | /** |