', 'package' => 'PhpDocumentor', 'dir_roles' => array('Documentation' => 'doc', 'Documentation/tests' => 'test'), 'exceptions' => array('index.html' => 'php', 'docbuilder/index.html' => 'php', 'docbuilder/blank.html' => 'php', 'README' => 'doc', 'ChangeLog' => 'doc', 'PHPLICENSE.txt' => 'doc', 'poweredbyphpdoc.gif' => 'data', 'INSTALL' => 'doc', 'FAQ' => 'doc', 'Authors' => 'doc', 'Release-1.2.0beta1' => 'doc', 'Release-1.2.0beta2' => 'doc', 'Release-1.2.0beta3' => 'doc', 'Release-1.2.0rc1' => 'doc', 'Release-1.2.0rc2' => 'doc', 'Release-1.2.0' => 'doc', 'Release-1.2.1' => 'doc', 'Release-1.2.2' => 'doc', 'pear-phpdoc' => 'script', 'pear-phpdoc.bat' => 'script'), 'ignore' => array('package.xml', "{$packagedir}/phpdoc", 'phpdoc.bat', 'LICENSE'), 'installas' => array('pear-phpdoc' => 'phpdoc', 'pear-phpdoc.bat' => 'phpdoc.bat'), 'installexceptions' => array('pear-phpdoc' => '/', 'pear-phpdoc.bat' => '/', 'scripts/makedoc.sh' => '/')));
if (PEAR::isError($e)) {
    echo $e->getMessage();
    exit;
}
$e = $test->addPlatformException('pear-phpdoc', '(*ix|*ux)');
if (PEAR::isError($e)) {
    echo $e->getMessage();
    exit;
}
$e = $test->addPlatformException('pear-phpdoc.bat', 'windows');
if (PEAR::isError($e)) {
    echo $e->getMessage();
    exit;
}
$e = $test->addDependency('php', '4.1.0', 'ge', 'php');
if (PEAR::isError($e)) {
    echo $e->getMessage();
    exit;
}
// replace @PHP-BIN@ in this file with the path to php executable!  pretty neat
$e = $test->addReplacement('pear-phpdoc', 'pear-config', '@PHP-BIN@', 'php_bin');
if (PEAR::isError($e)) {
    echo $e->getMessage();
    exit;
}
$e = $test->addReplacement('pear-phpdoc.bat', 'pear-config', '@PHP-BIN@', 'php_bin');
if (PEAR::isError($e)) {
    echo $e->getMessage();
    exit;
}
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";
}
// Par défaut, on considère que le package se situe dans le réperoire courant
$pkg_dir = isset($opts_h['--packagedir']) ? $opts_h['--packagedir'] : $opts_h['p'];
$pkg_dir = isset($pkg_dir) ? $pkg_dir : getcwd();
echo "Looking for files in {$pkg_dir}...\n";
$pkgxml = new PEAR_PackageFileManager();
# -- Options
$e = $pkgxml->setOptions(array('baseinstalldir' => '/', 'package' => 'Blogmarks', 'version' => '0.1', 'summary' => 'Stop bookmarking, start blogmarking', 'description' => 'Soon to come...', 'license' => 'GPL', 'packagedirectory' => $pkg_dir, 'filelistgenerator' => 'cvs', 'state' => 'beta', 'notes' => 'first try', 'ignore' => array('make_pkg.php'), 'installexceptions' => array(), 'dir_roles' => array('Blogmarks/tutorials' => 'doc'), 'exceptions' => array()));
# -- Roles
$pkgxml->addRole('ini', 'php');
$pkgxml->addRole('dist', 'php');
# -- Maintainers
$pkgxml->addMaintainer('mbertier', 'lead', 'Tristan Rivoallan', '*****@*****.**');
$pkgxml->addMaintainer('benfle', 'developer', 'Benoit Fleury', '*****@*****.**');
# -- Dépendances
$pkgxml->addDependency('DB_DataObject', '1.5.3', 'ge', 'pkg');
$pkgxml->addDependency('HTTP_Request', '1.2', 'ge', 'pkg');
if (PEAR::isError($e)) {
    echo "*** Erreur: " . $e->getMessage() . "\n";
    exit;
}
/*
$e = $pkgxml->debugPackageFile( false );

if ( PEAR::isError($e) ) {
    echo "*** Erreur: ". $e->getMessage() . "\n";
    exit;
}
*/
$e = $pkgxml->writePackageFile();
if (PEAR::isError($e)) {
Beispiel #4
0
<?php

/**
 * Net_growl package generator
 * @package Net_Growl
 */
require_once 'PEAR/PackageFileManager.php';
$version = '0.7.0';
$notes = <<<EOT
Initial release
EOT;
$description = <<<EOT
Growl is a MACOSX application that listen to notifications sent by 
applications and displays them on the desktop using different display 
styles. Net_Growl offers the possibility to send notifications to Growl 
from your PHP application through network communication using UDP.
EOT;
$package = new PEAR_PackageFileManager();
$e = $package->setOptions(array('package' => 'Net_Growl', 'summary' => 'Send notifications to Growl from PHP on MACOSX', 'description' => $description, 'version' => $version, 'state' => 'beta', 'license' => 'BSD', 'filelistgenerator' => 'file', 'ignore' => array('package.php', 'package.xml'), 'notes' => $notes, 'changelogoldtonew' => false, 'simpleoutput' => true, 'baseinstalldir' => 'Net', 'packagedirectory' => '/Volumes/doc/Dev/trunk/Bindings/php/Net_Growl'));
if (PEAR::isError($e)) {
    echo $e->getMessage();
    exit;
}
$package->addMaintainer('mansion', 'lead', 'Bertrand Mansion', '*****@*****.**');
$package->addDependency('PEAR', '1.3.3', 'ge', 'pkg', false);
$e = $package->writePackageFile();
if (PEAR::isError($e)) {
    echo $e->getMessage();
    exit;
}
echo "package.xml generated successfully!\n";
 [ 895656 ] initialized private variables not recognized as private
 [ 904823 ] IntermediateParser fatal error
 [ 910676 ] Fatal error: Smarty error: unable to write to $compile_dir
 [ 915770 ] Classes in file not showing
 [ 924313 ] Objec access on array
', 'package' => 'PhpDocumentor', 'dir_roles' => array('Documentation' => 'doc', 'Documentation/tests' => 'test', 'docbuilder' => 'data', 'HTML_TreeMenu-1.1.2' => 'data', 'tutorials' => 'doc', 'phpDocumentor/Converters/CHM/default/templates/default/templates_c' => 'data', 'phpDocumentor/Converters/PDF/default/templates/default/templates_c' => 'data', 'phpDocumentor/Converters/HTML/frames/templates/default/templates_c' => 'data', 'phpDocumentor/Converters/HTML/frames/templates/l0l33t/templates_c' => 'data', 'phpDocumentor/Converters/HTML/frames/templates/phpdoc.de/templates_c' => 'data', 'phpDocumentor/Converters/HTML/frames/templates/phphtmllib/templates_c' => 'data', 'phpDocumentor/Converters/HTML/frames/templates/phpedit/templates_c' => 'data', 'phpDocumentor/Converters/HTML/frames/templates/earthli/templates_c' => 'data', 'phpDocumentor/Converters/HTML/frames/templates/DOM/default/templates_c' => 'data', 'phpDocumentor/Converters/HTML/frames/templates/DOM/l0l33t/templates_c' => 'data', 'phpDocumentor/Converters/HTML/frames/templates/DOM/phpdoc.de/templates_c' => 'data', 'phpDocumentor/Converters/HTML/frames/templates/DOM/phphtmllib/templates_c' => 'data', 'phpDocumentor/Converters/HTML/frames/templates/DOM/earthli/templates_c' => 'data', 'phpDocumentor/Converters/HTML/Smarty/templates/default/templates_c' => 'data', 'phpDocumentor/Converters/HTML/Smarty/templates/PHP/templates_c' => 'data', 'phpDocumentor/Converters/HTML/Smarty/templates/HandS/templates_c' => 'data', 'phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates_c' => 'data'), 'simpleoutput' => true, 'exceptions' => array('index.html' => 'data', 'README' => 'doc', 'ChangeLog' => 'doc', 'PHPLICENSE.txt' => 'doc', 'poweredbyphpdoc.gif' => 'data', 'INSTALL' => 'doc', 'FAQ' => 'doc', 'Authors' => 'doc', 'Release-1.2.0beta1' => 'doc', 'Release-1.2.0beta2' => 'doc', 'Release-1.2.0beta3' => 'doc', 'Release-1.2.0rc1' => 'doc', 'Release-1.2.0rc2' => 'doc', 'Release-1.2.0' => 'doc', 'Release-1.2.1' => 'doc', 'Release-1.2.2' => 'doc', 'Release-1.2.3' => 'doc', 'Release-1.2.3.1' => 'doc', 'Release-1.3.0' => 'doc', 'pear-phpdoc' => 'script', 'pear-phpdoc.bat' => 'script', 'HTML_TreeMenu-1.1.2/TreeMenu.php' => 'php', 'phpDocumentor/Smarty-2.6.0/libs/debug.tpl' => 'php', 'new_phpdoc.php' => 'data', 'phpdoc.php' => 'data'), 'ignore' => array('package.xml', "{$packagedir}/phpdoc", 'phpdoc.bat', 'LICENSE', '*docbuilder/actions.php', '*docbuilder/builder.php', '*docbuilder/config.php', '*docbuilder/file_dialog.php', '*docbuilder/top.php', 'utilities.php', 'Converter.inc', 'IntermediateParser.inc', '*templates/PEAR/*', 'phpDocumentor/Smarty-2.5.0/*', '*CSV*', 'Setup.inc.php', 'makedocs.ini', 'common.inc.php', 'publicweb-PEAR-1.2.1.patch.txt'), 'installas' => array('pear-phpdoc' => 'phpdoc', 'pear-phpdoc.bat' => 'phpdoc.bat', 'docbuilder/pear-actions.php' => 'docbuilder/actions.php', 'docbuilder/pear-builder.php' => 'docbuilder/builder.php', 'docbuilder/pear-config.php' => 'docbuilder/config.php', 'docbuilder/pear-file_dialog.php' => 'docbuilder/file_dialog.php', 'docbuilder/pear-top.php' => 'docbuilder/top.php', 'docbuilder/includes/pear-utilities.php' => 'docbuilder/includes/utilities.php', 'phpDocumentor/pear-IntermediateParser.inc' => 'phpDocumentor/IntermediateParser.inc', 'phpDocumentor/pear-Converter.inc' => 'phpDocumentor/Converter.inc', 'phpDocumentor/pear-Setup.inc.php' => 'phpDocumentor/Setup.inc.php', 'phpDocumentor/pear-common.inc.php' => 'phpDocumentor/common.inc.php', 'user/pear-makedocs.ini' => 'user/makedocs.ini'), 'installexceptions' => array('pear-phpdoc' => '/', 'pear-phpdoc.bat' => '/', 'scripts/makedoc.sh' => '/')));
if (PEAR::isError($e)) {
    echo $e->getMessage();
    exit;
}
$e = $test->addPlatformException('pear-phpdoc.bat', 'windows');
if (PEAR::isError($e)) {
    echo $e->getMessage();
    exit;
}
$e = $test->addDependency('php', '4.1.0', 'ge', 'php');
if (PEAR::isError($e)) {
    echo $e->getMessage();
    exit;
}
// just to make sure people don't try to install this with a broken Archive_Tar
$e = $test->addDependency('Archive_Tar', '1.1', 'ge');
if (PEAR::isError($e)) {
    echo $e->getMessage();
    exit;
}
// optional dep for peardoc2 converter
$e = $test->addDependency('XML_Beautifier', '1.1', 'ge', 'pkg', true);
if (PEAR::isError($e)) {
    echo $e->getMessage();
    exit;
            die("!! Paramètre obligatoire non renseigné.\n");
        }
    }
}
// Par défaut, on considère que le package se situe dans le réperoire courant
$pkg_dir = isset($opts_h['--packagedir']) ? $opts_h['--packagedir'] : $opts_h['p'];
$pkg_dir = isset($pkg_dir) ? $pkg_dir : getcwd();
echo "Looking for files in {$pkg_dir}...\n";
$pkgxml = new PEAR_PackageFileManager();
# -- Options
$e = $pkgxml->setOptions(array('baseinstalldir' => '/', 'package' => 'Blogmarks_Server_Atom', 'version' => '0.1', 'summary' => 'Blogmarks\' Atom Server', 'description' => 'Soon to come...', 'license' => 'GPL', 'packagedirectory' => $pkg_dir, 'filelistgenerator' => 'cvs', 'state' => 'beta', 'notes' => 'first try', 'ignore' => array('scripts/make_pkg.php'), 'installexceptions' => array(), 'dir_roles' => array('tutorials' => 'doc'), 'exceptions' => array()));
# -- Maintainers
$pkgxml->addMaintainer('benfle', 'lead', 'Benoit Fleury', '*****@*****.**');
$pkgxml->addMaintainer('mbertier', 'developer', 'Tristan Rivoallan', '*****@*****.**');
# -- Dépendances
$pkgxml->addDependency('Blogmarks', '0.1', 'ge', 'pkg');
if (PEAR::isError($e)) {
    echo "*** Erreur: " . $e->getMessage() . "\n";
    exit;
}
/*
$e = $pkgxml->debugPackageFile( false );

if ( PEAR::isError($e) ) {
    echo "*** Erreur: ". $e->getMessage() . "\n";
    exit;
}
*/
$e = $pkgxml->writePackageFile();
if (PEAR::isError($e)) {
    echo "*** Erreur: " . $e->getMessage() . "\n";
}
/**
* A giant array to configure the PackageFileManager. For the "roles" see
* http://pear.php.net/manual/en/developers.packagedef.php
*/
$options = array('baseinstalldir' => 'simpletest', 'version' => $version, 'packagedirectory' => $packagedir, 'outputdirectory' => $packagedir, 'pathtopackagefile' => $packagedir, 'state' => $state, 'summary' => $shortDesc, 'description' => $longDesc, 'filelistgenerator' => 'file', 'notes' => $releaseNotes, 'package' => 'SimpleTest', 'license' => 'The Open Group Test Suite License', 'dir_roles' => array('docs' => 'doc', 'test' => 'test', 'extensions' => 'php'), 'exceptions' => array('HELP_MY_TESTS_DONT_WORK_ANYMORE' => 'doc', 'LICENSE' => 'doc', 'README' => 'doc', 'TODO' => 'doc', 'VERSION' => 'doc'), 'ignore' => array("{$packagedir}/packages", "{$packagedir}/ui"));
$status = $PPFM->setOptions($options);
if (PEAR::isError($status)) {
    fwrite(STDERR, $status->getMessage());
    exit;
}
foreach ($maintainers as $maintainer) {
    $PPFM->addMaintainer($maintainer['handle'], $maintainer['role'], $maintainer['name'], $maintainer['email']);
}
// Adds a dependency of PHP 4.2.3+
$status = $PPFM->addDependency('php', '4.2.3', 'ge', 'php');
if (PEAR::isError($status)) {
    fwrite(STDERR, $status->getMessage());
    exit;
}
// hack (apparently)
$PPFM->addRole('tpl', 'php');
$PPFM->addRole('png', 'php');
$PPFM->addRole('gif', 'php');
$PPFM->addRole('jpg', 'php');
$PPFM->addRole('css', 'php');
$PPFM->addRole('js', 'php');
$PPFM->addRole('ini', 'php');
$PPFM->addRole('inc', 'php');
$PPFM->addRole('afm', 'php');
$PPFM->addRole('pkg', 'doc');