[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/inc class.xslttemplates.inc.php
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc class.xslttemplates.inc.php |
Date: |
Wed, 22 Feb 2006 09:41:28 +0000 |
CVSROOT: /cvsroot/phpgwapi
Module name: phpgwapi
Branch:
Changes by: Dave Hall <address@hidden> 06/02/22 09:41:28
Modified files:
inc : class.xslttemplates.inc.php
Log message:
patch #4795 from Sigurd
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/phpgwapi/inc/class.xslttemplates.inc.php.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
Patches:
Index: phpgwapi/inc/class.xslttemplates.inc.php
diff -u phpgwapi/inc/class.xslttemplates.inc.php:1.20
phpgwapi/inc/class.xslttemplates.inc.php:1.21
--- phpgwapi/inc/class.xslttemplates.inc.php:1.20 Tue Apr 26 09:43:08 2005
+++ phpgwapi/inc/class.xslttemplates.inc.php Wed Feb 22 09:41:28 2006
@@ -8,29 +8,15 @@
* @license http://www.gnu.org/licenses/lpl.html GNU General Public
License
* @package phpgwapi
* @subpackage gui
- * @version $Id: class.xslttemplates.inc.php,v 1.20 2005/04/26 09:43:08
powerstat Exp $
+ * @version $Id: class.xslttemplates.inc.php,v 1.21 2006/02/22 09:41:28
skwashd Exp $
*/
- if(!extension_loaded('xslt'))
+ if(!extension_loaded('xslt') && !extension_loaded('xsl'))
{
- // phpgroupware anyway would not work properly with save_mode=on
- if(ini_get('safe_mode'))
- {
- echo 'PHP CONFIGURATION - SAVE_MODE = ON. Unable to
load the xslt-extension. Please contact the system administrator.';
+
+ echo 'PHP CONFIGURATION. xslt-extension is not loaded. Please
contact the system administrator.';
exit();
}
- else
- {
- if(PHP_OS == 'Windows' || PHP_OS == 'OS/2')
- {
- dl('php_xslt.dll');
- }
- else
- {
- dl('xslt.so');
- }
- }
- }
/**
@@ -74,6 +60,7 @@
$this->print = True;
}
$this->set_root($root);
+
}
function halt($msg)
@@ -168,7 +155,7 @@
}
}
- function set_var($name, $value, $append = True)
+ function set_var($name, $value, $append = False)
{
if($append)
{
@@ -176,17 +163,17 @@
{
while(list($key,$val) = each($value))
{
- if (!is_array($val) &&
!is_array($this->vars[$name][$key]))
+
+ if (is_array($val) &&
is_array($this->vars[$name][$key]))
{
-
$this->vars[$name][$key] .= $val;
+
$this->vars[$name][$key] = array_merge($this->vars[$name][$key],$val);
}
else
{
-
$this->vars[$name][$key] = array_merge($this->vars[$name][$key],$val);
+
$this->vars[$name][$key] .= $val;
}
}
}
- //_debug_array($this->vars);
}
else
{
@@ -266,9 +253,6 @@
{
$xmldata[$key] = $value;
}
- //$tmpxml_object = var2xml('PHPGW',$xmldata);
- //$this->xmldata = $tmpxml_object->dump_mem();
- //return $this->xmldata;
$this->xmldata = var2xml('PHPGW',$xmldata);
return $this->xmldata;
}
@@ -297,26 +281,41 @@
{
$this->xml_parse();
}
- $xsltproc = xslt_create();
$minor = explode(".",phpversion());
- if($minor[1] >= 1) // PHP 4.1.x -- preferred
+
+ if ($minor[0] == 5)
{
- $arguments = array('/_xml' => $this->xmldata,
'/_xsl' => $this->xsldata);
- $html =
xslt_process($xsltproc,'arg:/_xml','arg:/_xsl',NULL,$arguments);
+ $xml = new DOMDocument;
+ $xml->loadXML($this->xmldata);
+
+ $xsl = new DOMDocument;
+ $xsl->loadXML($this->xsldata);
+
+ // Configure the transformer
+ $proc = new XSLTProcessor;
+ $proc->importStyleSheet($xsl); // attach the
xsl rules
+
+ $html = $proc->transformToXML($xml);
}
- else /* PHP 4.0.6 -- works okay
- no, it doesnt work at all :) [ceb] */
+ else
{
- xslt_process($this->xsldata,
$this->xmldata,$html);
+ $xsltproc = xslt_create();
+ $arguments = array('/_xml' => $this->xmldata,
'/_xsl' => $this->xsldata);
+ $html =
xslt_process($xsltproc,'arg:/_xml','arg:/_xsl',NULL,$arguments);
+ xslt_free($xsltproc);
}
+
if (!$html)
{
echo "<p>xml-data = ";
$this->list_lineno($this->xmldata);
echo "<p>xsl-data = ";
$this->list_lineno($this->xsldata);
+ if ($minor[0] == 4)
+ {
die(/*$this->xsldata.*/"\n\n XSLT processing
error: ".xslt_error($xsltproc));
}
- xslt_free($xsltproc);
+ }
+
return $html;
}
- [Phpgroupware-cvs] phpgwapi/inc class.xslttemplates.inc.php,
Dave Hall <=