Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

articlelistrss.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: articlelistrss.php,v 1.6.2.2 2003/07/22 09:55:52 vl Exp $
5 //
6 // Created on: <11-Dec-2000 09:44:51 bf>
7 //
8 // This source file is part of Exponential Basic, publishing software.
9 //
10 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
11 //
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
25 //
26
27 // include_once( "classes/INIFile.php" );
28 // include_once( "classes/ezlocale.php" );
29 // include_once( "classes/eztexttool.php" );
30
31 // include_once( "ezarticle/classes/ezarticlecategory.php" );
32 // include_once( "ezarticle/classes/ezarticle.php" );
33 // include_once( "ezarticle/classes/ezarticlerenderer.php" );
34
35 $ini =& eZINI::instance( 'site.ini' );
36 $Title = htmlspecialchars($ini->variable( "eZArticleRSS", "Title" ));
37 $Link = $ini->variable( "eZArticleRSS", "Link" );
38 $Description = htmlspecialchars($ini->variable( "eZArticleRSS", "Description" ));
39 $Language = $ini->variable( "eZArticleRSS", "Language" );
40
41 $Image = $ini->variable( "eZArticleRSS", "Image" );
42 $CategoryID = $ini->variable( "eZArticleRSS", "CategoryID" );
43 $Limit = $ini->variable( "eZArticleRSS", "Limit" );
44
45 $headerInfo = ( getallheaders() );
46 $Host = $headerInfo["Host"] ;
47
48 // clear what might be in the output buffer
49 ob_end_clean();
50
51 // xml header
52 header( "Content-type: text/xml" );
53 print( "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n" );
54
55 // rss header
56 //print( "<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\" \"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n\n" );
57 print( "<rss version=\"0.92\">\n" );
58
59 print( "<channel>\n" );
60
61
62 print( "<title>$Title</title>\n" );
63 print( "<link>$Link</link>\n" );
64 print( "<description>$Description</description>\n" );
65 print( "<language>$Language</language>\n" );
66
67 // Print Channel Image Tag
68 print( "<image>\n" );
69 print( "<url>http://".$Host.$Image."</url>\n" );
70 print( "<link>http://".$Link."</link>\n" );
71 print( "<title>".Title."</title>\n" );
72 print( "</image>\n" );
73
74 // get articles. Always sort by date/time (newest first)
75 if ( $CategoryID == 0 )
76 {
77 $article = new eZArticle();
78 $articleList = $article->articles( "time", false, 0 , $Limit);
79 }
80 else
81 {
82 $category = new eZArticleCategory( $CategoryID );
83 $articleList = $category->articles( "time", false, true, 0 , $Limit );
84 }
85
86
87 $locale = new eZLocale( $Language );
88 foreach ( $articleList as $article )
89 {
90 $articleID = $article->id();
91
92
93 print( "<item>\n" );
94 print( "<title>" . htmlspecialchars($article->name()) . "</title>\n" );
95 print( "<link>http://" . $Host . "/article/view/$articleID/</link>\n" );
96
97 // $published = $article->published();
98 // print( $locale->format( $published ) );
99
100
101 // render the intro as HTML into the description tag:
102 $renderer = new eZArticleRenderer( $article );
103 $description = $renderer->renderIntro();
104
105 // prefix relative Links in href and src attributes with the Hostname, so the feed does not contain relative links and feedreaders can parse the links and show the images.
106 $description = str_replace("href=\"/", "href=\"http://".$Host."/", $description);
107 $description = str_replace("src=\"/", "src=\"http://".$Host."/", $description);
108
109 // encode HTML special character like < , > and " and print the tag
110 print( "<description>" . htmlspecialchars( $description ). "</description>\n" );
111
112 print( "</item>\n" );
113 }
114
115 print( "\n</channel>\n" );
116 print( "\n</rss>\n" );
117
118 exit();
119
120 ?>
$category
if( $Action=="Edit") $category
Definition: adedit.php:378
$Limit
$Limit
Definition: articlelistrss.php:43
$articleList
$articleList
Definition: articlelistrss.php:83
$Description
$Description
Definition: articlelistrss.php:38
$CategoryID
$CategoryID
Definition: articlelistrss.php:42
$locale
$locale
Definition: articlelistrss.php:87
$Title
$Title
Definition: articlelistrss.php:36
$Image
$Image
Definition: articlelistrss.php:41
$Language
$Language
Definition: articlelistrss.php:39
$ini
$ini
Definition: articlelistrss.php:35
$Host
$Host
Definition: articlelistrss.php:46
$Link
$Link
Definition: articlelistrss.php:37
$headerInfo
$headerInfo
Definition: articlelistrss.php:45
$article
$article
Definition: articlelog.php:45
$renderer
if(! $article->get( $ArticleID)) $renderer
Definition: articlepreview.php:76
eZArticleCategory
Definition: ezarticlecategory.php:45
eZArticleRenderer
Definition: ezarticlerenderer.php:36
eZArticle
Definition: ezarticle.php:82
eZLocale
Definition: ezlocale.php:119
exit
exit
Definition: folder.php:81
$articleID
if( $Action=="New") $articleID
Definition: user/articleedit.php:269
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.