Make WordPress Core

Ticket #17787: plugins-filters.2.patch

File plugins-filters.2.patch, 3.4 KB (added by 5ubliminal, 15 years ago)

One more tweak.

  • wp-admin/includes/plugin.php

     
    255255
    256256        if ( empty($plugin_files) )
    257257                return $wp_plugins;
     258               
     259        // filter these with a function name similar filter
     260        $plugin_files = apply_filters('get_plugins_files', $plugin_files); // [HACK]
    258261
    259262        foreach ( $plugin_files as $plugin_file ) {
    260263                if ( !is_readable( "$plugin_root/$plugin_file" ) )
     
    273276        $cache_plugins[ $plugin_folder ] = $wp_plugins;
    274277        wp_cache_set('plugins', $cache_plugins, 'plugins');
    275278
    276         return $wp_plugins;
     279        // filter these with a function name similar filter
     280        return apply_filters('get_plugins', $wp_plugins);
    277281}
    278282
    279283/**
  • wp-includes/load.php

     
    455455        closedir( $dh );
    456456        sort( $mu_plugins );
    457457
    458         return $mu_plugins;
     458        // filter these with a function name similar filter
     459        return apply_filters('get_mu_plugins', $mu_plugins);
    459460}
    460461
    461462/**
     
    484485
    485486        $network_plugins = is_multisite() ? wp_get_active_network_plugins() : false;
    486487
     488        // filter these with a function name similar filter
     489        $active_plugins = apply_filters('active_and_valid_plugins', $plugins);
     490       
    487491        foreach ( $active_plugins as $plugin ) {
    488492                if ( ! validate_file( $plugin ) // $plugin must validate as file
    489493                        && '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
     
    493497                        )
    494498                $plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
    495499        }
    496         return $plugins;
     500
     501        // filter these with a function name similar filter
     502        return apply_filters('get_active_and_valid_plugins', $plugins);
    497503}
    498504
    499505/**
  • wp-includes/ms-load.php

     
    4545        $active_plugins = array_keys( $active_plugins );
    4646        sort( $active_plugins );
    4747
     48        // filter these with a function name similar filter
     49        $active_plugins = apply_filters('active_network_plugins', $active_plugins);
     50       
    4851        foreach ( $active_plugins as $plugin ) {
    4952                if ( ! validate_file( $plugin ) // $plugin must validate as file
    5053                        && '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
     
    5255                        )
    5356                $plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
    5457        }
    55         return $plugins;
     58
     59        // filter these with a function name similar filter
     60        return apply_filters('get_active_network_plugins', $plugins);
    5661}
    5762
    5863/**
  • wp-settings.php

     
    149149// Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in.
    150150wp_plugin_directory_constants( );
    151151
     152// Attempt to load wp-plugins.php from ABSPATH or ABSPATH's parent.
     153// This allows those who manage WordPress to tweak MU plugins before loaded.
     154// Combining this with wp-config.php outisde ABSPATH, a multi instance
     155// WordPress environment can be created.
     156if(is_file(ABSPATH.'/wp-plugins.php')) require_once(ABSPATH.'/wp-plugins.php');
     157else if(is_file(ABSPATH.'/../wp-plugins.php')) require_once(ABSPATH.'/../wp-plugins.php');
     158
    152159// Load must-use plugins.
    153160foreach ( wp_get_mu_plugins() as $mu_plugin ) {
    154161        include_once( $mu_plugin );