rss_xslt.patch (2.2 kb) added by Damien Pobel
--- dev/kernel/classes/ezrssexport.php 2006-02-06 19:02:07.000000000 +0100
+++ public_html/ez/kernel/classes/ezrssexport.php 2006-09-30 17:56:33.000000000 +0200
@@ -416,6 +416,11 @@
$doc = new eZDOMDocument();
$doc->setName( 'eZ publish RSS Export' );
+ $xsltStylesheet = eZRSSExport::fetchXSLTStylesheetURL();
+ if ( $xsltStylesheet !== false )
+ {
+ $doc->setStylesheet( $xsltStylesheet );
+ }
$root = $doc->createElementNode( 'rss', array( 'version' => '2.0' ) );
$doc->setRoot( $root );
@@ -597,6 +602,11 @@
$doc = new eZDOMDocument();
$doc->setName( 'eZ publish RSS Export' );
+ $xsltStylesheet = eZRSSExport::fetchXSLTStylesheetURL();
+ if ( $xsltStylesheet !== false )
+ {
+ $doc->setStylesheet( $xsltStylesheet );
+ }
$root = $doc->createElementNode( 'rdf:RDF', array( 'xmlns:rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
'xmlns:rdfs' => 'http://www.w3.org/2000/01/rdf-schema#',
'xmlns:dc' => 'http://purl.org/dc/elements/1.1/',
@@ -793,5 +803,32 @@
return 'http://'.$url;
}
+
+ /*!
+ \private
+
+ Fetch the XSLT Stylesheet. If non exist, return false
+
+ \return valid XSLT stylesheet url
+ */
+ function fetchXSLTStylesheetURL()
+ {
+ $config = &eZINI::instance();
+ if ( $config->hasVariable( 'RSSSettings', 'XSLTStylesheet' ) )
+ {
+ include_once( 'kernel/common/eztemplatedesignresource.php' );
+ $XSLTStylesheet = $config->variable( 'RSSSettings', 'XSLTStylesheet' );
+ $bases = eZTemplateDesignResource::allDesignBases();
+ foreach( $bases as $base)
+ {
+ if ( file_exists( $base . "/stylesheets/" . $XSLTStylesheet ) )
+ {
+ $RelativeURL = '/' . $base . "/stylesheets/" . $XSLTStylesheet;
+ return 'http://' . eZSys::hostname() . eZSys::wwwDir() . $RelativeURL;
+ }
+ }
+ }
+ return false;
+ }
}
?>