Looks like this functionality is not in 1.2. The functions alphaoide linked to aren’t available in 1.2 so they probubly only work in 1.5.
And it appears that doing:
$menu[46] = array(‘Backup/Restore’, 10, ‘backupRestore.php’)
doesn’t work either. So as a cheap hack I put this in menu.php under where the $menu array is created:
// Add gallery to the Admin Menu
include(‘../wp-content/plugins/galleries/galleries_functions.php’);
$add_menu = new galleries();
$menu = $add_menu->gallery_add_menu($menu);
The gallery_functions.php file will check to see if the plugin is loaded and if so it will insert the ‘Galleries’ Item in the admin menu. Below is galleries_functions.php in case anyone is interested:
<?php
class galleries
{
//
// This check to see if Galleries is installed. If so it will add it to the menu
//
function gallery_add_menu($menu) {
$newset_menu = $menu;
$installed = galleries::check_installed();
$array_counter = 0;
if ($installed) {
foreach ($menu as $menu2)
{
if ($array_counter == 2)
{
$menu3[$array_counter] = array(‘Galleries’, 3, ‘galleries.php’, ‘Galleries’);
++$array_counter;
$menu3[$array_counter] = $menu2;
} else {
$menu3[$array_counter] = $menu2;
}
++$array_counter;
}
return $menu3;
} else {
// not installed
return $menu;
}
}
//
// Adapted from wp-plugin-list.php from Matt Read
//
function check_installed() {
$installed = false;
// Files in wp-content/plugins directory
$plugins_dir = @ dir(ABSPATH . ‘wp-content/plugins’);
if ($plugins_dir) {
while(($file = $plugins_dir->read()) !== false) {
if ( !preg_match(‘|^\.+$|’, $file) && preg_match(‘|\.php$|’, $file) )
$plugin_files[] = $file;
}
}
if (” != trim(get_settings(‘active_plugins’))) {
$current_plugins = explode(“\n”, (get_settings(‘active_plugins’)));
}
if (!$plugins_dir || !$plugin_files) {
_e(“Error”); // TODO: make more helpful
break;
} else {
sort($plugin_files); // Alphabetize by filename. Better way?
$style = ”;
foreach($plugin_files as $plugin_file) {
$plugin_data = implode(”, file(ABSPATH . ‘/wp-content/plugins/’ . $plugin_file));
preg_match(“|Plugin Name:(.*)|i”, $plugin_data, $plugin_name);
preg_match(“|Plugin URI:(.*)|i”, $plugin_data, $plugin_uri);
preg_match(“|Description:(.*)|i”, $plugin_data, $description);
preg_match(“|Author:(.*)|i”, $plugin_data, $author_name);
preg_match(“|Author URI:(.*)|i”, $plugin_data, $author_uri);
if ( preg_match(“|Version:(.*)|i”, $plugin_data, $version) ) {
$version = $version[1];
} else {
$version =”;
}
$description = wptexturize($description[1]);
if (!empty($current_plugins) && in_array($plugin_file, $current_plugins)) {
// If Galleries is found return true
if (trim($plugin_name[1]) == ‘Galleries’) {
$installed = true;
return $installed;
}
}
}
// echo $plugs;
return $installed;
}
}
}
?>