[Picfinity-commit] SF.net SVN: picfinity: [27] index.php
Status: Beta
Brought to you by:
espadav8
From: <esp...@us...> - 2007-08-12 04:02:30
|
Revision: 27 http://picfinity.svn.sourceforge.net/picfinity/?rev=27&view=rev Author: espadav8 Date: 2007-08-11 21:02:00 -0700 (Sat, 11 Aug 2007) Log Message: ----------- Add a check for PHP version so we use the correct xsl code Modified Paths: -------------- index.php Modified: index.php =================================================================== --- index.php 2007-08-10 14:17:49 UTC (rev 26) +++ index.php 2007-08-12 04:02:00 UTC (rev 27) @@ -338,17 +338,34 @@ function xml_to_xhtml($xml, $xsl_file, $params = array()) { - $doc = new DOMDocument(); - $xsl = new XSLTProcessor(); + $ver = explode( '.', PHP_VERSION ); + $ver_num = $ver[0] . $ver[1] . $ver[2]; - $doc->load($xsl_file); - $xsl->importStyleSheet($doc); + if ( $ver_num < 500 ) + { + $arguments = array('/_xml' => $xml); + $xsltproc = xslt_create(); + $html = xslt_process($xsltproc, 'arg:/_xml', $xsl_file, NULL, $arguments); - $doc->loadXML($xml); + if (empty($html)) { + die('XSLT processing error: '. xslt_error($xsltproc)); + } + xslt_free($xsltproc); + return $html; + } + else + { + $doc = new DOMDocument(); + $xsl = new XSLTProcessor(); - $xsl->setParameter('', $params); + $doc->load($xsl_file); + $xsl->importStyleSheet($doc); - return $xsl->transformToXML($doc); + $doc->loadXML($xml); + $xsl->setParameter('', $params); + + return $xsl->transformToXML($doc); + } } function MakeDirectory($dir, $mode = 0755) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |