Making WordPress.org


Ignore:
Timestamp:
04/14/2016 08:23:22 PM (8 years ago)
Author:
iandunn
Message:

Jetpack Tweaks: Break into multiple files for better organization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/load-other-mu-plugins.php

    r2442 r2958  
    33defined( 'WPINC' ) or die();
    44
    5 // mu-plugins in sub-directories
    6 require_once( __DIR__ . '/wp-cli-commands/bootstrap.php' );
    7 require_once( __DIR__ . '/camptix-tweaks/camptix-tweaks.php' );
     5wcorg_include_individual_mu_plugins();
     6wcorg_include_mu_plugin_folders();
    87
    9 // Private mu-plugins
    10 $private_mu_plugins = glob( WP_CONTENT_DIR . '/mu-plugins-private/*.php' );
    11 if ( is_array( $private_mu_plugins ) ) {
    12     foreach ( $private_mu_plugins as $plugin ) {
    13         if ( is_file( $plugin ) ) {
    14             require_once( $plugin );
     8/**
     9 * Load individually-targeted files
     10 *
     11 * This is because the folder contains some .php files that we don't want to automatically include with glob().
     12 */
     13function wcorg_include_individual_mu_plugins() {
     14    require_once( __DIR__ . '/wp-cli-commands/bootstrap.php' );
     15    require_once( __DIR__ . '/camptix-tweaks/camptix-tweaks.php' );
     16}
     17
     18/**
     19 * Load every mu-plugin in these folders
     20 */
     21function wcorg_include_mu_plugin_folders() {
     22    $include_folders = array(
     23        dirname( __DIR__ ) . '/mu-plugins-private',
     24        __DIR__ . '/jetpack-tweaks',
     25    );
     26
     27    foreach ( $include_folders as $folder ) {
     28        $plugins = glob( $folder . '/*.php' );
     29
     30        if ( is_array( $plugins ) ) {
     31            foreach ( $plugins as $plugin ) {
     32                if ( is_file( $plugin ) ) {
     33                    require_once( $plugin );
     34                }
     35            }
    1536        }
    1637    }
Note: See TracChangeset for help on using the changeset viewer.