|
From: alex <bin...@li...> - 2001-08-12 01:35:22
|
alex Sat Aug 11 18:35:17 2001 EDT
Modified files:
/r2/binarycloud/base/utils xml2php.php
Log:
Modified import.
Index: r2/binarycloud/base/utils/xml2php.php
diff -u r2/binarycloud/base/utils/xml2php.php:1.3 r2/binarycloud/base/utils/xml2php.php:1.4
--- r2/binarycloud/base/utils/xml2php.php:1.3 Mon Jun 25 10:01:32 2001
+++ r2/binarycloud/base/utils/xml2php.php Sat Aug 11 18:35:17 2001
@@ -2,7 +2,7 @@
<?php
// {{{ Header
/*
- * -File $Id: xml2php.php,v 1.3 2001/06/25 17:01:32 odysseas Exp $
+ * -File $Id: xml2php.php,v 1.4 2001/08/12 01:35:17 alex Exp $
* -License LGPL (http://www.gnu.org/copyleft/lesser.html)
* -Copyright 2001, Intacct Corp.
* -Author odysseas tsatalos, ody...@ya...
@@ -31,7 +31,7 @@
// }}}
// Process {{{
-import('XMLUtils');
+import('binarycloud.base.lib.XMLUtils');
$trees = XMLUtils::XMLStr2XML(join('',file($xmlfile, 1)));
$xmlTree = $trees[0];
switch ($form) {
|
|
From: alex <bin...@li...> - 2001-08-24 00:07:14
|
alex Thu Aug 23 17:07:08 2001 EDT
Modified files:
/r2/binarycloud/base/utils xml2php.php
Log:
Andris revisions on xml2php.
Index: r2/binarycloud/base/utils/xml2php.php
diff -u r2/binarycloud/base/utils/xml2php.php:1.5 r2/binarycloud/base/utils/xml2php.php:1.6
--- r2/binarycloud/base/utils/xml2php.php:1.5 Mon Aug 20 20:24:57 2001
+++ r2/binarycloud/base/utils/xml2php.php Thu Aug 23 17:07:08 2001
@@ -1,11 +1,12 @@
-#!c:/php/php.exe -q
+#!/usr/local/php4/bin/php -q
<?php
// {{{ Header
/*
- * -File $Id: xml2php.php,v 1.5 2001/08/21 03:24:57 alex Exp $
+ * -File $Id: xml2php.php,v 1.6 2001/08/24 00:07:08 alex Exp $
* -License LGPL (http://www.gnu.org/copyleft/lesser.html)
* -Copyright 2001, Intacct Corp.
* -Author odysseas tsatalos, ody...@ya...
+ * -Author Andris Spruds, an...@do...
*/
// }}}
@@ -21,8 +22,7 @@
$type = $argv[0]; array_shift($argv);
$xmlfile = $argv[0];
$outfile = $argv[1];
-// A stupid hack. This shoulld be done in makefile.
-// Andris Spruds (an...@do...)
+// _small_stupid_hack_ This should be done in makefile. Andris Spruds (an...@do...)
$outfile=ereg_replace(".xml.php$",".php",$outfile);
// }}}
@@ -30,74 +30,55 @@
import('binarycloud.lib.XMLUtils');
$trees = XMLUtils::XMLStr2XML(join('',file($xmlfile, 1)));
$xmlTree=$trees[0];
-$phpTree = XMLUtils::XML2PHP($xmlTree);
+$phpTree = XMLUtils::XML2PHP($xmlTree);
+$txtTree = XMLUtils::PHP2PHPArr($phpTree,false);
+$nl="\r\n";
switch ($type) {
case 'page_def' :
- $txtTree = XMLUtils::XML2PHPArr($xmlTree);
- $txtTree = ereg_replace(",\r\n$","",$txtTree);
- $txtTree = ereg_replace("^'".$xmlTree['tag']."' =>","\$gPageDef = ",$txtTree);
- $buffer="<?\r\n";
- $buffer.="import('binarycloud.init.Init');\r\n\r\n";
- $buffer.=$txtTree;
- $buffer.=";\r\n\r\n";
- $buffer.="\$Init = new Init();\r\n";
- $buffer.="\$Init->Startup();\r\n";
- $buffer.="\$Page->BuildPage();\r\n";
- $buffer.="\$Init->Shutdown();\r\n";
- $buffer.="?>";
+ $buffer.="include_once('./prepend.php');".$nl;
+ $buffer.="import('binarycloud.init.Init');";
+ $buffer.=$nl.$nl;
+ $buffer.="\$gPageDef = ";
+ $buffer.=$txtTree;
+ $buffer.=$nl.$nl;
+ $buffer.="\$Init = new Init();" . $nl;
+ $buffer.="\$Init->Startup();" . $nl;
+ $buffer.="\$Page->BuildPage();" . $nl;
+ $buffer.="\$Init->Shutdown();";
break;
case 'lang_def' :
- $txtTree = XMLUtils::XML2PHPArr($xmlTree);
- $txtTree = ereg_replace(",\r\n$","",$txtTree);
- $txtTree = ereg_replace("^'".$xmlTree['tag']."' =>","\$Lang->langs = ",$txtTree);
- $buffer="<?\r\n";
- $buffer.="global \$Lang;\r\n\r\n";
+ $buffer.="global \$Lang;";
+ $buffer.=$nl.$nl;
+ $buffer.="\$Lang->langs = ";
$buffer.=$txtTree;
- $buffer.=";\r\n\r\n";
- $buffer.="?>";
break;
case 'conf_def' :
- $txtTree = XMLUtils::XML2PHPDef($xmlTree);
- $buffer="<?\r\n";
+ $txtTree=XMLUtils::XML2PHPDef($xmlTree);
$buffer.=$txtTree;
- $buffer.="?>";
break;
case 'datasources_def' :
- $txtTree = XMLUtils::XML2PHPArr($xmlTree);
- $txtTree = ereg_replace(",\r\n$","",$txtTree);
- $txtTree = ereg_replace("^'".$xmlTree['tag']."' =>","\$datasources = ",$txtTree);
- $buffer="<?\r\n";
- $buffer.=$txtTree;
- $buffer.=";\r\n\r\n";
- $buffer.="?>";
- break;
- case 'operations_def' :
- $txtTree = XMLUtils::XML2PHPArr($xmlTree);
- $txtTree = ereg_replace(",\r\n$","",$txtTree);
- $txtTree = ereg_replace("^'".$xmlTree['tag']."' =>","\$operations = ",$txtTree);
- $buffer="<?\r\n";
+ $buffer.="global \$QueryManager;";
+ $buffer.=$nl.$nl;
+ $buffer.="\$QueryManager->datasources = ";
$buffer.=$txtTree;
- $buffer.=";\r\n\r\n";
- $buffer.="?>";
break;
- case 'roles_def' :
- $txtTree = XMLUtils::XML2PHPArr($xmlTree);
- $txtTree = ereg_replace(",\r\n$","",$txtTree);
- $txtTree = ereg_replace("^'".$xmlTree['tag']."' =>","\$roles[me] = ",$txtTree);
- $buffer="<?\r\n";
- $buffer.=$txtTree;
- $buffer.=";\r\n\r\n";
- $buffer.="?>";
- break;
default:
- die("Type '$type' is invalid. Valid styles are page_def,lang_def,conf_def,ds_def,roles_def.\n");
+ $buffer.=$txtTree;
break;
- }
+}
// }}}
// Produce output {{{
+$header="// XML2PHP {{{".$nl;
+$header.="/******************************************************************************".$nl;
+$header.="** -Source $xmlfile".$nl;
+$header.="******************************************************************************/".$nl;
+$header.="// }}}".$nl;
+
+$buffer="<?".$nl.$header.$nl.$buffer.$nl;
+$buffer.="?>";
if ($outfile) {
$dir_name=dirname($outfile);
@@ -105,9 +86,9 @@
mkdir($dir_name,0700);
}
- $fd = @fopen( $outfile, "w" ) or die( "Could not open file for writing : $outfile\n" );
+ $fd = @fopen( $outfile, "w" ) or die( "XML2PHP : could not open file for writing : $outfile\n" );
fwrite( $fd, $buffer, strlen($buffer) );
fclose($fd);
}
// }}}
-?>
\ No newline at end of file
+?>
|
|
From: andi <bin...@li...> - 2001-09-12 18:11:47
|
andi Wed Sep 12 11:11:41 2001 EDT
Modified files:
/r2/binarycloud/base/utils xml2php.php
Log:
Changes to match php.xml format
Index: r2/binarycloud/base/utils/xml2php.php
diff -u r2/binarycloud/base/utils/xml2php.php:1.6 r2/binarycloud/base/utils/xml2php.php:1.7
--- r2/binarycloud/base/utils/xml2php.php:1.6 Thu Aug 23 17:07:08 2001
+++ r2/binarycloud/base/utils/xml2php.php Wed Sep 12 11:11:41 2001
@@ -2,7 +2,7 @@
<?php
// {{{ Header
/*
- * -File $Id: xml2php.php,v 1.6 2001/08/24 00:07:08 alex Exp $
+ * -File $Id: xml2php.php,v 1.7 2001/09/12 18:11:41 andi Exp $
* -License LGPL (http://www.gnu.org/copyleft/lesser.html)
* -Copyright 2001, Intacct Corp.
* -Author odysseas tsatalos, ody...@ya...
@@ -23,7 +23,7 @@
$xmlfile = $argv[0];
$outfile = $argv[1];
// _small_stupid_hack_ This should be done in makefile. Andris Spruds (an...@do...)
-$outfile=ereg_replace(".xml.php$",".php",$outfile);
+$outfile=ereg_replace(".php.xml$",".php",$outfile);
// }}}
// Process {{{
|
|
From: andi <bin...@li...> - 2001-10-07 14:07:17
|
andi Sun Oct 7 07:07:12 2001 EDT
Modified files:
/r2/binarycloud/base/utils xml2php.php
Log:
Added conf/ImageRepository.php.xml and related processing (xml2php)
Index: r2/binarycloud/base/utils/xml2php.php
diff -u r2/binarycloud/base/utils/xml2php.php:1.7 r2/binarycloud/base/utils/xml2php.php:1.8
--- r2/binarycloud/base/utils/xml2php.php:1.7 Wed Sep 12 11:11:41 2001
+++ r2/binarycloud/base/utils/xml2php.php Sun Oct 7 07:07:12 2001
@@ -2,7 +2,7 @@
<?php
// {{{ Header
/*
- * -File $Id: xml2php.php,v 1.7 2001/09/12 18:11:41 andi Exp $
+ * -File $Id: xml2php.php,v 1.8 2001/10/07 14:07:12 andi Exp $
* -License LGPL (http://www.gnu.org/copyleft/lesser.html)
* -Copyright 2001, Intacct Corp.
* -Author odysseas tsatalos, ody...@ya...
@@ -11,6 +11,8 @@
// }}}
// Initialize {{{
+global $HTTP_SERVER_VARS;
+$argv = $HTTP_SERVER_VARS['argv'];
$kUsageStr = "Usage: $argv[0] SITEBUILD_DIR TYPE XML_FILE OUT_FILE\n";
if (sizeof($argv)!=5) die($kUsageStr);
array_shift($argv);
@@ -61,6 +63,12 @@
$buffer.="global \$QueryManager;";
$buffer.=$nl.$nl;
$buffer.="\$QueryManager->datasources = ";
+ $buffer.=$txtTree;
+ break;
+ case 'images_def' :
+ $buffer.="global \$ImageRepository;";
+ $buffer.=$nl.$nl;
+ $buffer.="\$ImageRepository = ";
$buffer.=$txtTree;
break;
default:
|