+++ /dev/null
-# Makefile for phpxmlrpc library\r
-\r
-### USER EDITABLE VARS - can be passed as command-line options ###\r
-\r
-# path to PHP executable, preferably CLI version\r
-PHP=php\r
-\r
-# path were xmlrpc lib files will be copied to\r
-PHPINCLUDEDIR=/usr/local/lib/php\r
-\r
-# mkdir is a thorny beast under windows: make sure we can not use the cmd version, running eg. "make MKDIR=mkdir.exe"\r
-MKDIR=mkdir\r
-\r
-#find too\r
-FIND=find\r
-\r
-DOS2UNIX=dos2unix\r
-\r
-#### DO NOT TOUCH FROM HERE ONWARDS ###\r
-\r
-# recover version number from code\r
-# thanks to Firman Pribadi for unix command line help\r
-# on unix shells lasts char should be \\2/g )\r
-export VERSION=$(shell grep -E "\$GLOBALS *\[ *'xmlrpcVersion' *\] *= *'" lib/xmlrpc.inc | sed -r s/"(.*= *' *)([0-9a-zA-Z.-]+)(.*)"/\2/g )\r
-\r
-LIBFILES=lib/xmlrpc.inc lib/xmlrpcs.inc lib/xmlrpc_wrappers.inc \\r
- src/*.php src/Helper/*.php\r
-\r
-EXTRAFILES=extras/test.pl \\r
- extras/test.py \\r
- extras/rsakey.pem \\r
- extras/workspace.testPhpServer.fttb\r
-\r
-DEMOFILES=demo/vardemo.php \\r
- demo/demo1.xml \\r
- demo/demo2.xml \\r
- demo/demo3.xml\r
-\r
-DEMOSFILES=demo/server/discuss.php \\r
- demo/server/server.php \\r
- demo/server/proxy.php\r
-\r
-DEMOCFILES=demo/client/agesort.php \\r
- demo/client/client.php \\r
- demo/client/comment.php \\r
- demo/client/introspect.php \\r
- demo/client/mail.php \\r
- demo/client/simple_call.php \\r
- demo/client/which.php \\r
- demo/client/wrap.php \\r
- demo/client/zopetest.php\r
-\r
-TESTFILES=test/testsuite.php \\r
- tests/benchmark.php \\r
- tests/parse_args.php \\r
- test/InvalidHostTest.php \\r
- test/LocalHostTest.php \\r
- test/ParsingBugsTest.php \\r
- tests/verify_compat.php\r
-\r
-INFOFILES=Changelog \\r
- Makefile \\r
- NEWS \\r
- README\r
-\r
-DEBUGGERFILES=debugger/index.php \\r
- debugger/action.php \\r
- debugger/common.php \\r
- debugger/controller.php\r
-\r
-\r
-all: install\r
-\r
-install:\r
- cp ${LIBFILES} ${PHPINCLUDEDIR}\r
- @echo Lib files have been copied to ${PHPINCLUDEDIR}\r
- cd doc && $(MAKE) install\r
-\r
-test:\r
- cd test && ${PHP} -q testsuite.php\r
-\r
-\r
-### the following targets are to be used for library development ###\r
-\r
-# make tag target: tag existing working copy as release in git.\r
-tag:\r
- git tag v${VERSION}\r
- git push origin --tags\r
-\r
-dist: xmlrpc-${VERSION}.zip xmlrpc-${VERSION}.tar.gz\r
-\r
-xmlrpc-${VERSION}.zip xmlrpc-${VERSION}.tar.gz: ${LIBFILES} ${DEBUGGERFILES} ${INFOFILES} ${TESTFILES} ${EXTRAFILES} ${DEMOFILES} ${DEMOSFILES} ${DEMOCFILES}\r
- @echo ---${VERSION}---\r
- rm -rf xmlrpc-${VERSION}\r
- ${MKDIR} xmlrpc-${VERSION}\r
- ${MKDIR} xmlrpc-${VERSION}/demo\r
- ${MKDIR} xmlrpc-${VERSION}/demo/client\r
- ${MKDIR} xmlrpc-${VERSION}/demo/server\r
- ${MKDIR} xmlrpc-${VERSION}/test\r
- ${MKDIR} xmlrpc-${VERSION}/test/PHPUnit\r
- ${MKDIR} xmlrpc-${VERSION}/extras\r
- ${MKDIR} xmlrpc-${VERSION}/lib\r
- ${MKDIR} xmlrpc-${VERSION}/debugger\r
- cp --parents ${DEMOFILES} xmlrpc-${VERSION}\r
- cp --parents ${DEMOCFILES} xmlrpc-${VERSION}\r
- cp --parents ${DEMOSFILES} xmlrpc-${VERSION}\r
- cp --parents ${TESTFILES} xmlrpc-${VERSION}\r
- cp --parents ${EXTRAFILES} xmlrpc-${VERSION}\r
- cp --parents ${LIBFILES} xmlrpc-${VERSION}\r
- cp --parents ${DEBUGGERFILES} xmlrpc-${VERSION}\r
- cp ${INFOFILES} xmlrpc-${VERSION}\r
- cd doc && $(MAKE) dist\r
-# on unix shells last char should be \;\r
- ${FIND} xmlrpc-${VERSION} -type f ! -name "*.fttb" ! -name "*.pdf" ! -name "*.gif" -exec ${DOS2UNIX} ;\r
- -rm xmlrpc-${VERSION}.zip xmlrpc-${VERSION}.tar.gz\r
- tar -cvf xmlrpc-${VERSION}.tar xmlrpc-${VERSION}\r
- gzip xmlrpc-${VERSION}.tar\r
- zip -r xmlrpc-${VERSION}.zip xmlrpc-${VERSION}\r
-\r
-doc:\r
- cd doc && $(MAKE) doc\r
-\r
-clean:\r
- rm -rf xmlrpc-${VERSION} xmlrpc-${VERSION}.zip xmlrpc-${VERSION}.tar.gz\r
- cd doc && $(MAKE) clean\r
- at debug level 1, curl communication info are not dumped to screen
- at debug level 1, the tests echo payloads of failures; at debug level 2 all payloads
+* improved: makefiles have been replaced with a php_based pakefile
+
XML-RPC for PHP version 3.0.0 - 2014/6/15
"codeclimate/php-test-reporter": "dev-master",
"ext-curl": "*",
"ext-mbstring": "*",
- "indeyets/pake": "~1.99"
+ "indeyets/pake": "~1.99",
+ "phpdocumentor/phpdocumentor": "2.*"
},
"suggest": {
"ext-curl": "Needed for HTTPS and HTTP 1.1 support, NTLM Auth etc...",
+++ /dev/null
-\r
-### USER EDITABLE VARS ###\r
-\r
-WEB=/var/www/xmlrpc/doc\r
-\r
-MKDIR=mkdir\r
-\r
-PHP=php\r
-\r
-FOP=fop\r
-\r
-PHPDOC=phpdoc\r
-\r
-\r
-#### DO NOT TOUCH FROM HERE ONWARDS ###\r
-\r
-install:\r
- ${MKDIR} -p ${WEB}\r
- cp *.html ${WEB}\r
- cp *.css ${WEB}\r
- cp *.gif ${WEB}\r
- @echo HTML version of the manual has been installed to ${WEB}\r
-\r
-\r
-### the following targets are to be used for library development ###\r
-\r
-doc: out/index.html xmlrpc_php.pdf javadoc-out/index.html\r
-\r
-# tools currently used in building docs: php 5 with xsl extension, apache fop, phpdocumentor\r
-# alternatives include doxygen, jade, saxon, xsltproc etc...\r
-\r
-out/index.html xmlrpc_php.pdf: xmlrpc_php.xml\r
- -${MKDIR} out\r
-# Jade cmd yet to be rebuilt, starting from xml file and putting output in ./out dir, e.g.\r
-# jade -t xml -d custom.dsl xmlrpc_php.xml\r
-#\r
-# convertdoc command for xmlmind xxe editor\r
-# convertdoc docb.toHTML xmlrpc_php.xml -u out\r
-#\r
-# saxon + xerces xml parser + saxon extensions + xslthl: adds a little syntax highligting\r
-# (bold and italics only, no color) for php source examples...\r
-# java \\r
-# -classpath c:\programmi\saxon\saxon.jar\;c:\programmi\saxon\xslthl.jar\;c:\programmi\xerces\xercesImpl.jar\;C:\htdocs\xmlrpc_cvs\docbook-xsl\extensions\saxon65.jar \\r
-# -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl \\r
-# -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl \\r
-# -Dxslthl.config=file:///c:/htdocs/xmlrpc_cvs/docbook-xsl/highlighting/xslthl-config.xml \\r
-# com.icl.saxon.StyleSheet -o xmlrpc_php.fo.xml xmlrpc_php.xml custom.fo.xsl use.extensions=1\r
-#\r
-# custom php script that does the xslt magic\r
- ${PHP} convert.php xmlrpc_php.xml custom.xsl out/\r
-# post process html files to highlight php code samples\r
- ${PHP} highlight.php out\r
-# convert to fo and then to pdf using apache fop\r
- ${PHP} convert.php xmlrpc_php.xml custom.fo.xsl xmlrpc_php.fo.xml\r
- ${FOP} xmlrpc_php.fo.xml xmlrpc_php.pdf\r
-# -rm xmlrpc_php.fo.xml\r
-\r
-javadoc-out/index.html: ../lib/xmlrpc.inc ../lib/xmlrpcs.inc ../lib/xmlrpc_wrappers.inc\r
-# generate docs out of javadoc via doxygen\r
-# doxygen phpxmlrpc.dox\r
-#\r
-# generate docs out of javadoc via phpdocumentor\r
- ${PHP} ${PHPDOC} -f ../lib/xmlrpc.inc,../lib/xmlrpcs.inc,../lib/xmlrpc_wrappers.inc -t javadoc-out --title PHP-XMLRPC\r
- -rm -rf javadoc-out/phpdoc-cache-*\r
-\r
-dist: doc\r
- ${MKDIR} -p ../xmlrpc-${VERSION}/doc\r
- -cp out/*.html ../xmlrpc-${VERSION}/doc\r
- -cp out/*.css ../xmlrpc-${VERSION}/doc\r
- -cp out/*.gif ../xmlrpc-${VERSION}/doc\r
- -cp out/*.pdf ../xmlrpc-${VERSION}/doc\r
- cp xmlrpc_php.xml ../xmlrpc-${VERSION}/doc\r
- cp xmlrpc_php.pdf ../xmlrpc-${VERSION}/doc\r
- cp Makefile ../xmlrpc-${VERSION}/doc\r
-\r
-clean:\r
- -rm -f out/*.html\r
- -rm -rf javadoc-out\r
- -rm xmlrpc_php.fo.xml\r
- -rm xmlrpc_php.pdf\r
+++ /dev/null
-<?php
-/**
- * Script used to convert docbook source to human readable docs.
- *
- * @copyright (c) 2007-2015 G. Giunta
- */
-if ($_SERVER['argc'] < 4) {
- die("Usage: php convert.php docbook.xml \path\\to\stylesheet.xsl output-dir|output_file\n");
-} else {
- echo "Starting xsl conversion process...\n";
-}
-
-$doc = $_SERVER['argv'][1];
-$xss = $_SERVER['argv'][2];
-
-if (!file_exists($doc)) {
- die("KO: file $doc cannot be found\n");
-}
-if (!file_exists($xss)) {
- die("KO: file $xss cannot be found\n");
-}
-
-// Load the XML source
-$xml = new DOMDocument();
-$xml->load($doc);
-$xsl = new DOMDocument();
-$xsl->load($xss);
-
-// Configure the transformer
-$proc = new XSLTProcessor();
-if (version_compare(PHP_VERSION, '5.4', "<")) {
- if (defined('XSL_SECPREF_WRITE_FILE')) {
- ini_set("xsl.security_prefs", XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_FILE);
- }
-} else {
- // the php online docs only mention setSecurityPrefs, but somehow some installs have setSecurityPreferences...
- if (method_exists('XSLTProcessor', 'setSecurityPrefs')) {
- $proc->setSecurityPrefs(XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_FILE);
- } else {
- $proc->setSecurityPreferences(XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_FILE);
- }
-}
-$proc->importStyleSheet($xsl); // attach the xsl rules
-
-//if ($_SERVER['argc'] >= 4)
-//{
-if (is_dir($_SERVER['argv'][3])) {
- if (!$proc->setParameter('', 'base.dir', realpath($_SERVER['argv'][3]))) {
- echo "setting param base.dir KO\n";
- }
-} else {
- //echo "{$_SERVER['argv'][3]} is not a dir\n";
-}
-//}
-
-$out = $proc->transformToXML($xml);
-if (!is_dir($_SERVER['argv'][3])) {
- file_put_contents($_SERVER['argv'][3], $out);
-}
-
-echo "OK\n";
\r
\r
<!-- import base stylesheet -->\r
-<xsl:import href="../../../tools/docbook-xsl/fo/docbook.xsl"/>\r
+<xsl:import href="../../../vendor/docbook/docbook-xsl/fo/docbook.xsl"/>\r
\r
\r
<!-- customization vars -->\r
+++ /dev/null
-<?php
-/**
- * takes a dir as arg, highlights all php code found in html files inside.
- *
- * @author Gaetano Giunta
- * @copyright (c) 2007-2015 G. Giunta
- */
-function highlight($file)
-{
- $starttag = '<pre class="programlisting">';
- $endtag = '</pre>';
-
- $content = file_get_contents($file);
- $last = 0;
- $out = '';
- while (($start = strpos($content, $starttag, $last)) !== false) {
- $end = strpos($content, $endtag, $start);
- $code = substr($content, $start + strlen($starttag), $end - $start - strlen($starttag));
- if ($code[strlen($code) - 1] == "\n") {
- $code = substr($code, 0, -1);
- }
-
- $code = str_replace(array('>', '<'), array('>', '<'), $code);
- $code = highlight_string('<?php ' . $code, true);
- $code = str_replace('<span style="color: #0000BB"><?php <br />', '<span style="color: #0000BB">', $code);
-
- $out = $out . substr($content, $last, $start + strlen($starttag) - $last) . $code . $endtag;
- $last = $end + strlen($endtag);
- }
- $out .= substr($content, $last, strlen($content));
-
- return $out;
-}
-
-$dir = $argv[1];
-
-$files = scandir($dir);
-foreach ($files as $file) {
- if (substr($file, -5, 5) == '.html') {
- $out = highlight($dir . '/' . $file);
- file_put_contents($dir . '/' . $file, $out);
- }
-}
* Makefile for phpxmlrpc library.
* To be used with the Pake tool: https://github.com/indeyets/pake/wiki
*
- * @todo allow user to specify location for zip command
+ * @copyright (c) 2015 G. Giunta
+ *
* @todo allow user to specify release number and tag/branch to use
*/
class Builder
{
- protected static $buildDir = 'build/';
+ protected static $buildDir = 'build';
protected static $libVersion;
protected static $sourceBranch = 'master';
+ protected static $tools = array(
+ 'zip' => 'zip',
+ 'fop' => 'fop',
+ 'php' => 'php'
+ );
public static function libVersion()
{
public static function workspaceDir()
{
- return self::buildDir().'workspace';
+ return self::buildDir().'/workspace';
}
/// most likely things will break if this one is moved outside of BuildDir
public static function distDir()
{
- return self::buildDir().'xmlrpc-'.self::libVersion();
+ return self::buildDir().'/xmlrpc-'.self::libVersion();
}
/// these will be generated in BuildDir
if (count($args) > 1)
self::$sourceBranch = $args[1];
- pake_echo('---'.self::$libVersion.'---');
+ foreach (self::$tools as $name => $binary) {
+ if (isset($cliOpts[$name])) {
+ self::$tools[$name] = $cliOpts[$name];
+ }
+ }
+
+ //pake_echo('---'.self::$libVersion.'---');
+ }
+
+ public static function tool($name)
+ {
+ return self::$tools[$name];
+ }
+
+ /**
+ * @param string $inFile
+ * @param string $xssFile
+ * @param string $outFileOrDir
+ * @throws \Exception
+ */
+ public static function applyXslt($inFile, $xssFile, $outFileOrDir)
+ {
+
+ if (!file_exists($inFile)) {
+ throw new \Exception("File $inFile cannot be found");
+ }
+ if (!file_exists($xssFile)) {
+ throw new \Exception("File $xssFile cannot be found");
+ }
+
+ // Load the XML source
+ $xml = new \DOMDocument();
+ $xml->load($inFile);
+ $xsl = new \DOMDocument();
+ $xsl->load($xssFile);
+
+ // Configure the transformer
+ $processor = new \XSLTProcessor();
+ if (version_compare(PHP_VERSION, '5.4', "<")) {
+ if (defined('XSL_SECPREF_WRITE_FILE')) {
+ ini_set("xsl.security_prefs", XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_FILE);
+ }
+ } else {
+ // the php online docs only mention setSecurityPrefs, but somehow some installs have setSecurityPreferences...
+ if (method_exists('XSLTProcessor', 'setSecurityPrefs')) {
+ $processor->setSecurityPrefs(XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_FILE);
+ } else {
+ $processor->setSecurityPreferences(XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_FILE);
+ }
+ }
+ $processor->importStyleSheet($xsl); // attach the xsl rules
+
+ if (is_dir($outFileOrDir)) {
+ if (!$processor->setParameter('', 'base.dir', realpath($outFileOrDir))) {
+ echo "setting param base.dir KO\n";
+ }
+ }
+
+ $out = $processor->transformToXML($xml);
+
+ if (!is_dir($outFileOrDir)) {
+ file_put_contents($outFileOrDir, $out);
+ }
+ }
+
+ public static function highlightPhpInHtml($content)
+ {
+ $startTag = '<pre class="programlisting">';
+ $endTag = '</pre>';
+
+ //$content = file_get_contents($inFile);
+ $last = 0;
+ $out = '';
+ while (($start = strpos($content, $startTag, $last)) !== false) {
+ $end = strpos($content, $endTag, $start);
+ $code = substr($content, $start + strlen($startTag), $end - $start - strlen($startTag));
+ if ($code[strlen($code) - 1] == "\n") {
+ $code = substr($code, 0, -1);
+ }
+
+ $code = str_replace(array('>', '<'), array('>', '<'), $code);
+ $code = highlight_string('<?php ' . $code, true);
+ $code = str_replace('<span style="color: #0000BB"><?php <br />', '<span style="color: #0000BB">', $code);
+
+ $out = $out . substr($content, $last, $start + strlen($startTag) - $last) . $code . $endTag;
+ $last = $end + strlen($endTag);
+ }
+ $out .= substr($content, $last, strlen($content));
+
+ return $out;
}
}
function run_default($task=null, $args=array(), $cliOpts=array())
{
- echo "Syntax: pake {\$pake-options} \$task \$lib-version [\$git-tag]\n";
+ echo "Syntax: pake {\$pake-options} \$task \$lib-version [\$git-tag] {\$task-options}\n";
echo "\n";
echo " Run 'pake help' to list all pake options\n";
echo " Run 'pake -T' to list all available tasks\n";
+ echo " Task options:\n";
+ echo " --php=\$php";
+ echo " --fop=\$fop";
+ echo " --zip=\$zip";
}
function run_getopts($task=null, $args=array(), $cliOpts=array())
{
}
+function run_clean_doc()
+{
+ pake_remove_dir(Builder::workspaceDir().'/doc/out');
+ pake_remove_dir(Builder::workspaceDir().'/doc/javadoc-out');
+}
+
/**
* Generates documentation in all formats
*/
function run_doc($task=null, $args=array(), $cliOpts=array())
{
- pake_echo('TBD...');
+ $docDir = Builder::workspaceDir().'/doc';
+
+ // API docs from phpdoc comments using phpdocumentor
+ $cmd = Builder::tool('php');
+ pake_sh("$cmd vendor/phpdocumentor/phpdocumentor/bin/phpdoc run -d ".Builder::workspaceDir().'/src'." -t ".Builder::workspaceDir().'/doc/javadoc-out --title PHP-XMLRPC');
+
+ # Jade cmd yet to be rebuilt, starting from xml file and putting output in ./out dir, e.g.
+ # jade -t xml -d custom.dsl xmlrpc_php.xml
+ #
+ # convertdoc command for xmlmind xxe editor
+ # convertdoc docb.toHTML xmlrpc_php.xml -u out
+ #
+ # saxon + xerces xml parser + saxon extensions + xslthl: adds a little syntax highligting
+ # (bold and italics only, no color) for php source examples...
+ # java \
+ # -classpath c:\programmi\saxon\saxon.jar\;c:\programmi\saxon\xslthl.jar\;c:\programmi\xerces\xercesImpl.jar\;C:\htdocs\xmlrpc_cvs\docbook-xsl\extensions\saxon65.jar \
+ # -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl \
+ # -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl \
+ # -Dxslthl.config=file:///c:/htdocs/xmlrpc_cvs/docbook-xsl/highlighting/xslthl-config.xml \
+ # com.icl.saxon.StyleSheet -o xmlrpc_php.fo.xml xmlrpc_php.xml custom.fo.xsl use.extensions=1
+
+ pake_mkdirs($docDir.'/out');
+
+ // HTML files from docbook
+
+ Builder::applyXslt($docDir.'/xmlrpc_php.xml', $docDir.'/custom.xsl', $docDir.'/out/');
+ // post process html files to highlight php code samples
+ foreach(pakeFinder::type('file')->name('*.html')->in($docDir) as $file)
+ {
+ file_put_contents($file, Builder::highlightPhpInHtml(file_get_contents($file)));
+ }
+
+ // PDF file from docbook
+
+ // convert to fo and then to pdf using apache fop
+ Builder::applyXslt($docDir.'/xmlrpc_php.xml', $docDir.'/custom.fo.xsl', $docDir.'/xmlrpc_php.fo.xml');
+ $cmd = Builder::tool('fop');
+ pake_sh("$cmd $docDir/xmlrpc_php.fo.xml $docDir/xmlrpc_php.pdf");
+ unlink($docDir.'/xmlrpc_php.fo.xml');
}
function run_clean_dist()
// also: do we still need to run dos2unix?
// create tarballs
+ $cwd = getcwd();
chdir(dirname(Builder::distDir()));
foreach(Builder::distFiles() as $distFile) {
// php can not really create good zip files via phar: they are not compressed!
if (substr($distFile, -4) == '.zip') {
- $cmd = 'zip';
+ $cmd = Builder::tool('zip');
$extra = '-9 -r';
pake_sh("$cmd $distFile $extra ".basename(Builder::distDir()));
}
rename($pharFile, $distFile);
}
}
+ chdir($cwd);
}
/**
// internal task: parse cli options
pake_task('getopts');
pake_task('init', 'getopts');
-pake_task('doc', 'getopts', 'init');
+pake_task('doc', 'getopts', 'init', 'clean-doc');
pake_task('build', 'getopts', 'init', 'doc');
pake_task('dist', 'getopts', 'init', 'build', 'clean-dist');
+pake_task('clean-doc', 'getopts');
pake_task('clean-dist', 'getopts');
pake_task('clean', 'getopts');