Subversion Repositories eFlore/Archives.herbiers

Rev

Rev 16 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 16 Rev 21
Line 17... Line 17...
17
// |                                                                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
19
// | License along with this library; if not, write to the Free Software                                  |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: hb_rss.php,v 1.8 2006-11-07 17:28:21 jp_milcent Exp $
22
// CVS : $Id: hb_rss.php,v 1.9 2007-08-22 14:34:04 jp_milcent Exp $
23
/**
23
/**
24
* Générateur de flux RSS pour les Herbiers 
24
* Générateur de flux RSS pour les Herbiers 
25
*
25
*
26
*@package bazar
26
*@package bazar
27
//Auteur original :
27
//Auteur original :
28
*@author        Florian SCHMITT <florian@ecole-et-nature.org>
28
*@author        Florian SCHMITT <florian@ecole-et-nature.org>
29
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
29
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
30
*
30
*
31
*@copyright     Tela-Botanica 2000-2006
31
*@copyright     Tela-Botanica 2000-2006
32
*@version       $Revision: 1.8 $ $Date: 2006-11-07 17:28:21 $
32
*@version       $Revision: 1.9 $ $Date: 2007-08-22 14:34:04 $
33
// +------------------------------------------------------------------------------------------------------+
33
// +------------------------------------------------------------------------------------------------------+
34
*/
34
*/
Line 35... Line 35...
35
 
35
 
36
//==================================== LES FLUX RSS==================================
36
//==================================== LES FLUX RSS==================================
Line 164... Line 164...
164
		$aso_infos = array();
164
		$aso_infos = array();
165
		$aso_infos['title'] = 'Flux RSS : '.$flux;
165
		$aso_infos['title'] = 'Flux RSS : '.$flux;
166
		$GLOBALS['_HERBIER_']['rss']['url']->addQueryString('type', $flux);
166
		$GLOBALS['_HERBIER_']['rss']['url']->addQueryString('type', $flux);
167
		$aso_infos['link'] = str_replace('&', '&amp;', $GLOBALS['_HERBIER_']['rss']['url']->getURL());
167
		$aso_infos['link'] = str_replace('&', '&amp;', $GLOBALS['_HERBIER_']['rss']['url']->getURL());
168
		$aso_infos['description'] = 'Flux RSS sur les '.$flux.'s.';
168
		$aso_infos['description'] = 'Flux RSS sur les '.$flux.'s.';
169
		$aso_infos['pubdate'] = strftime('%d %b %Y %H:%M:%S GMT', strtotime(str_replace('$', '', str_replace('Date: ', '', '$Date: 2006-11-07 17:28:21 $'))));
169
		$aso_infos['pubdate'] = strftime('%d %b %Y %H:%M:%S GMT', strtotime(str_replace('$', '', str_replace('Date: ', '', '$Date: 2007-08-22 14:34:04 $'))));
170
		$tab_infos[] = $aso_infos;
170
		$tab_infos[] = $aso_infos;
171
	} 
171
	} 
172
}
172
}
173
// En fonction, de l'appel depuis Papyrus ou pas nous affichons du XML ou du XHTML
173
// En fonction, de l'appel depuis Papyrus ou pas nous affichons du XML ou du XHTML
174
if (!defined('PAP_VERSION')) {
174
if (!defined('PAP_VERSION')) {
175
	$sortie = html_entity_decode(gen_RSS($aso_meta, $tab_infos, $limite));
175
	$sortie = html_entity_decode(hb_generer_rss($aso_meta, $tab_infos, $limite));
176
} else {
176
} else {
177
	$sortie = gen_XHTML($aso_meta, $tab_infos);
177
	$sortie = hb_generer_xhtml($aso_meta, $tab_infos);
178
}
178
}
Line 179... Line 179...
179
 
179
 
180
/** gen_XHTML() - generer la liste des flux en XHTML 
180
/** hb_generer_xhtml() - generer la liste des flux en XHTML 
181
*
181
*
182
* @param   array Les  méta données des flux
182
* @param   array Les  méta données des flux
183
* @param   array Les infos sur les flux
183
* @param   array Les infos sur les flux
184
* 
184
* 
185
* @return  string La liste des flux RSS
185
* @return  string La liste des flux RSS
186
*/
186
*/
187
function gen_XHTML($meta = '', $infos = '')
187
function hb_generer_xhtml($meta = '', $infos = '')
188
{
188
{
189
	$xhtml = '<h1>'.$meta['titre'].'</h1>'."\n";
189
	$xhtml = '<h1>'.$meta['titre'].'</h1>'."\n";
190
	$xhtml .= '<p>'.$meta['description'].'</p>'."\n";
190
	$xhtml .= '<p>'.$meta['description'].'</p>'."\n";
191
	$xhtml .= '<ul>'."\n";
191
	$xhtml .= '<ul>'."\n";
Line 197... Line 197...
197
	}
197
	}
198
	$xhtml .= '</ul>'."\n";
198
	$xhtml .= '</ul>'."\n";
199
	return $xhtml;
199
	return $xhtml;
200
}
200
}
Line 201... Line 201...
201
 
201
 
202
/** gen_RSS() - generer un fichier de flux RSS par type d'annonce 
202
/** hb_generer_rss() - generer un fichier de flux RSS par type d'annonce 
203
*
203
*
204
* @param   array Les  méta données du flux
204
* @param   array Les  méta données du flux
205
* @param   array Les items du flux
205
* @param   array Les items du flux
206
* 
206
* 
207
* @return  string Le code du flux RSS
207
* @return  string Le code du flux RSS
208
*/
208
*/
209
function gen_RSS($meta = '', $infos = '')
209
function hb_generer_rss($meta = '', $infos = '')
210
{
210
{
211
	// En-tete du flux RSS version 2.0
211
	// En-tete du flux RSS version 2.0
212
	$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n";
212
	$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n";
213
	$xml .= '<rss version="2.0">'."\n";
213
	$xml .= '<rss version="2.0">'."\n";
Line 255... Line 255...
255
	return $xml;
255
	return $xml;
256
}
256
}
257
/* +--Fin du code ----------------------------------------------------------------------------------------+
257
/* +--Fin du code ----------------------------------------------------------------------------------------+
258
*
258
*
259
* $Log: not supported by cvs2svn $
259
* $Log: not supported by cvs2svn $
-
 
260
* Revision 1.8  2006-11-07 17:28:21  jp_milcent
-
 
261
* Correction concernant les urls des collections.
-
 
262
*
260
* Revision 1.7  2006/10/31 16:03:42  jp_milcent
263
* Revision 1.7  2006/10/31 16:03:42  jp_milcent
261
* Correction rendu xhtml dans Papyrus.
264
* Correction rendu xhtml dans Papyrus.
262
*
265
*
263
* Revision 1.6  2006/10/31 15:33:15  jp_milcent
266
* Revision 1.6  2006/10/31 15:33:15  jp_milcent
264
* Gestion d'un rendu XHTML pour Papyrus.
267
* Gestion d'un rendu XHTML pour Papyrus.