19,7 → 19,7 |
// | License along with this library; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: hb_rss.php,v 1.5 2006-10-31 15:06:44 jp_milcent Exp $ |
// CVS : $Id: hb_rss.php,v 1.6 2006-10-31 15:33:15 jp_milcent Exp $ |
/** |
* Générateur de flux RSS pour les Herbiers |
* |
29,7 → 29,7 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
* |
*@copyright Tela-Botanica 2000-2006 |
*@version $Revision: 1.5 $ $Date: 2006-10-31 15:06:44 $ |
*@version $Revision: 1.6 $ $Date: 2006-10-31 15:33:15 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
166,25 → 166,48 |
$GLOBALS['_HERBIER_']['rss']['url']->addQueryString('type', $flux); |
$aso_infos['link'] = str_replace('&', '&', $GLOBALS['_HERBIER_']['rss']['url']->getURL()); |
$aso_infos['description'] = 'Flux RSS sur les '.$flux.'s.'; |
$aso_infos['pubdate'] = strftime('%d %b %Y %H:%M:%S GMT', strtotime(str_replace('$', '', str_replace('Date: ', '', '$Date: 2006-10-31 15:06:44 $')))); |
$aso_infos['pubdate'] = strftime('%d %b %Y %H:%M:%S GMT', strtotime(str_replace('$', '', str_replace('Date: ', '', '$Date: 2006-10-31 15:33:15 $')))); |
$tab_infos[] = $aso_infos; |
} |
} |
echo html_entity_decode(gen_RSS($aso_meta, $tab_infos, $nbitem)); |
// En fonction, de l'appel depuis Papyrus ou pas nous affichons du XML ou du XHTML |
if (!defined('PAP_VERSION')) { |
$sortie = html_entity_decode(gen_RSS($aso_meta, $tab_infos, $limite)); |
} else { |
$sortie = gen_XHTML($aso_meta, $tab_infos); |
} |
|
/** gen_XHTML() - generer la liste des flux en XHTML |
* |
* @param array Les méta données des flux |
* @param array Les infos sur les flux |
* |
* @return string La liste des flux RSS |
*/ |
function gen_XHTML($meta = '', $infos = '') |
{ |
$xhtml = '<h1>'.$meta['titre'].'</h1>'."\n"; |
$xhtml = '<p>'.$meta['description'].'</p>'."\n"; |
$xhtml .= '<ul>'."\n"; |
foreach ($infos as $info) { |
$xhtml .= '<li>'."\n"; |
$xhtml .= '<a href="'.$meta['link'].'"><strong>'.$info['title'].'</strong></a><br />'."\n"; |
$xhtml .= $info['description']."\n"; |
$xhtml .= '</li>'."\n"; |
} |
$xhtml .= '</ul>'."\n"; |
return $xhtml; |
} |
|
/** gen_RSS() - generer un fichier de flux RSS par type d'annonce |
* |
* @param string Le type de l'annonce (laisser vide pour tout type d'annonce) |
* @param integer Le nombre d'annonces a regrouper dans le fichier XML (laisser vide pour toutes) |
* @param integer L'identifiant de l'emetteur (laisser vide pour tous) |
* @param integer L'etat de validation de l'annonce (laisser 1 pour les annonces validees, 0 pour les non-validees) |
* @param string La requete SQL personnalisee |
* @param integer La categorie des fiches bazar |
* |
* @param array Les méta données du flux |
* @param array Les items du flux |
* |
* @return string Le code du flux RSS |
*/ |
function gen_RSS($meta = '', $infos = '', $nbitem = '') { |
function gen_RSS($meta = '', $infos = '') |
{ |
// En-tete du flux RSS version 2.0 |
$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n"; |
$xml .= '<rss version="2.0">'."\n"; |
234,6 → 257,9 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.5 2006/10/31 15:06:44 jp_milcent |
* Fin de gestion des flux rss. |
* |
* Revision 1.4 2006/10/31 12:42:00 jp_milcent |
* Amélioration de la gestion de la date des flux via les infos cvs. |
* |