'.$plugin.'';
}
if ('' == $author_uri[1]) {
$author = trim($author_name[1]);
} else {
$author = '' . trim($author_name[1]) . '';
}
return array ('Name' => $name, 'Title' => $plugin, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template[1]);
}
/*
* function: get_mu_plugins_from_subdirectories()
* return: returns an array of plugin filenames to be loaded
*/
function get_mu_plugins_from_subdirectories()
{
$more_mu_plugins = array();
$plugin_root = ABSPATH . 'wp-content/mu-plugins';
// Files in wp-content/mu-plugins directory
$plugins_dir = @ dir($plugin_root);
if ($plugins_dir)
{
while (($file = $plugins_dir->read()) !== false)
{
if (preg_match('|^\.+$|', $file))
continue;
if (is_dir($plugin_root.'/'.$file))
{
$plugins_subdir = @ dir($plugin_root.'/'.$file);
if ($plugins_subdir)
{
while (($subfile = $plugins_subdir->read()) !== false)
{
if (preg_match('|^\.+$|', $subfile))
continue;
if (preg_match('|\.php$|', $subfile))
$plugin_files[] = "$file/$subfile";
}
}
}
else
{
if (preg_match('|\.php$|', $file))
$plugin_files[] = $file;
}
}
}
if (!$plugins_dir || !$plugin_files)
return $more_mu_plugins;
foreach ($plugin_files as $plugin_file)
{
$plugin_file_and_path = "$plugin_root/$plugin_file";
if (!is_readable($plugin_file_and_path))
{
//echo "File: $plugin_file_and_path -- SKIPPING, not readable\n
";
continue;
}
$plugin_data = get_sub_dir_plugin_data($plugin_file_and_path);
if (empty($plugin_data['Name']))
{
//echo "File: $plugin_file_and_path -- SKIPPING, No Name\n
";
continue;
}
$more_mu_plugins[] = $plugin_file_and_path;
//echo "File: $plugin_file_and_path -- INCLUDING\n
";
}
return $more_mu_plugins;
}
/*
* This little chunk of code here, does the actual work of loading the plugins. It is
* going to be exectuted when our main plugin (this one here that you're looking
* at) gets included by wp-settings.
*
*/
$wpdb->hide_errors();
$plugins = get_mu_plugins_from_subdirectories();
if(is_array($plugins))
{
foreach ($plugins as $plugin)
{
if(is_file($plugin))
include_once($plugin);
}
}
$wpdb->show_errors();
?>