Beispiel #1
0
}
$e = $packagexml->addMaintainer('jsweat', 'helper', 'Jason Sweat', '*****@*****.**');
if (is_a($e, 'PEAR_Error')) {
    echo $e->getMessage();
    exit;
}
$e = $packagexml->addMaintainer('pp11', 'helper', 'Perrick Penet', '*****@*****.**');
if (is_a($e, 'PEAR_Error')) {
    echo $e->getMessage();
    exit;
}
$e = $packagexml->addMaintainer('shpikat', 'helper', 'Constantine Shpikat', '*****@*****.**');
if (is_a($e, 'PEAR_Error')) {
    echo $e->getMessage();
    exit;
}
$e = $packagexml->addMaintainer('demianturner', 'helper', 'Demian Turner', '*****@*****.**');
if (is_a($e, 'PEAR_Error')) {
    echo $e->getMessage();
    exit;
}
// note use of {@link debugPackageFile()} - this is VERY important
if (isset($_GET['make']) || isset($_SERVER['argv'][2]) && $_SERVER['argv'][2] == 'make') {
    $e = $packagexml->writePackageFile();
} else {
    $e = $packagexml->debugPackageFile();
}
if (is_a($e, 'PEAR_Error')) {
    echo $e->getMessage();
    die;
}
XML_Serializer serializes complex data structures like arrays or object as XML documents.
This class helps you generating any XML document you require without the need for DOM.
Furthermore this package can be used as a replacement to serialize() and unserialize() as it comes with a matching XML_Unserializer that is able to create PHP data structures (like arrays and objects) from XML documents, if type hints are available.
If you use the XML_Unserializer on standard XML files, it will try to guess how it has to be unserialized. In most cases it does exactly what you expect it to do.
Try reading a RSS file with XML_Unserializer and you have the whole RSS file in a structured array or even a collection of objects, similar to XML_RSS.

Since version 0.8.0 the package is able to treat XML documents similar to the simplexml extension of PHP 5.
EOT;
$package = new PEAR_PackageFileManager();
$result = $package->setOptions(array('package' => 'XML_Serializer', 'summary' => 'Swiss-army knife for reading and writing XML files. Creates XML files from data structures and vice versa.', 'description' => $description, 'version' => $version, 'state' => $state, 'license' => 'BSD License', 'filelistgenerator' => 'cvs', 'ignore' => array('package.php', 'package.xml', 'package2.xml'), 'notes' => $notes, 'simpleoutput' => true, 'baseinstalldir' => 'XML', 'packagedirectory' => './', 'dir_roles' => array('docs' => 'doc', 'examples' => 'doc', 'tests' => 'test')));
if (PEAR::isError($result)) {
    echo $result->getMessage();
    die;
}
$package->addMaintainer('schst', 'lead', 'Stephan Schmidt', '*****@*****.**');
$package->addMaintainer('ashnazg', 'lead', 'Chuck Burgess', '*****@*****.**');
$package->addGlobalReplacement('package-info', '@package_version@', 'version');
$package->addDependency('php', '4.2.0', 'ge', 'php', false);
$package->addDependency('PEAR', '', 'has', 'pkg', false);
$package->addDependency('XML_Parser', '1.2.6', 'ge', 'pkg', false);
$package->addDependency('XML_Util', '1.1.1', 'ge', 'pkg', false);
if (isset($_GET['make']) || isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'make') {
    $result = $package->writePackageFile();
} else {
    $result = $package->debugPackageFile();
}
if (PEAR::isError($result)) {
    echo $result->getMessage();
    die;
}
echo "\n\nNOTICE:\n" . "  After using 'pear convert' to generate package2.xml,\n" . "  you must update the developers' <active> tags\n" . "  and verify the new <api> tag is correct.\n\n";
}
$e = $test->addReplacement('pear-phpdoc.bat', 'pear-config', '@PHP-BIN@', 'php_bin');
if (PEAR::isError($e)) {
    echo $e->getMessage();
    exit;
}
// hack until they get their shit in line with docroot role
$test->addRole('tpl', 'php');
$test->addRole('png', 'php');
$test->addRole('gif', 'php');
$test->addRole('jpg', 'php');
$test->addRole('css', 'php');
$test->addRole('js', 'php');
$test->addRole('ini', 'php');
$test->addRole('inc', 'php');
$test->addRole('afm', 'php');
$test->addRole('pkg', 'doc');
$test->addRole('cls', 'doc');
$test->addRole('proc', 'doc');
$test->addRole('sh', 'script');
if (isset($_GET['make'])) {
    $e = $test->writePackageFile();
} else {
    $e = $test->debugPackageFile();
}
if (PEAR::isError($e)) {
    echo $e->getMessage();
}
if (!isset($_GET['make'])) {
    echo '<a href="' . $_SERVER['PHP_SELF'] . '?make=1">Make this file</a>';
}