<?php
/**
* @package Mambo Open Source
* @copyright (C) 2005 - 2006 Mambo Foundation Inc.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*
* Mambo was originally developed by Miro (www.miro.com.au) in 2000. Miro assigned the copyright in Mambo to The Mambo Foundation in 2005 to ensure
* that Mambo remained free Open Source software owned and managed by the community.
* Mambo is Free Software
*/
/*
Function to get file listing. Adapted from PHP manual opendir user comments - http://www.php.net/manual/en/function.opendir.php#53045
*/
function getFiles($directory) {
// Try to open the directory
if($dir = opendir($directory)) {
// Create an array for all files found
$tmp = Array();
// Add the files
while($file = readdir($dir)) {
// Make sure the file exists
if($file != "." && $file != ".." && $file[0] != '.') {
// If it's a directory, list all files within it
if(is_dir($directory . "/" . $file)) {
$tmp2 = getFiles($directory . "/" . $file);
if(is_array($tmp2)) {
$tmp = array_merge($tmp, $tmp2);
}
} else {
array_push($tmp, $directory . "/" . $file);
}
}
}
// Finish off the function
closedir($dir);
return $tmp;
}
else echo "<br />Can't access the requested directory! Check that directory exists and that user has read permissions.";
}
// Get files from the requested directory
$arr = getFiles('.'); // This will find all files in the passed directory and all subdirectories
if ($arr) {
//Help text
echo "The text below can be used to help create an XML install file for your plugin....<br />";
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br /><br />";
//Setup the XML file header
echo htmlentities('<?xml version="1.0" ?>') . '<br /><br />';
echo htmlentities('<mosinstall version="4.6" type="Examples: mambot, component, module" group="editors">') . '<br />';
echo htmlentities('<name>Your plugin name</name>') . '<br />';
echo htmlentities('<version>Version number</version>') . '<br />';
echo htmlentities('<creationDate>The create date</creationDate>') . '<br />';
echo htmlentities('<author>Your name</author>') . '<br />';
echo htmlentities('<authorEmail>Your email address</authorEmail>') . '<br />';
echo htmlentities('<authorUrl>Your website</authorUrl>') . '<br />';
echo htmlentities('<copyright>Your copyright</copyright>') . '<br />';
echo htmlentities('<license>Your license here (ex) GPL / LGPL</license>') . '<br />';
echo htmlentities('<description>Your description here</description>"') . '<br /><br />';
echo htmlentities('<files>') . '<br />';
//Output the file listing
foreach ($arr as $value) {
echo (htmlentities("<filename>") . "$value" . htmlentities("</filename>") . "<br />");
}
//Add the XML file footer
echo htmlentities('</files>') . '<br />';
echo htmlentities('<mosinstall>') . '<br />';
}
?>