| Line 19... |
Line 19... |
| 19 |
// | |
|
19 |
// | |
|
| 20 |
// | You should have received a copy of the GNU General Public License |
|
20 |
// | You should have received a copy of the GNU General Public License |
|
| 21 |
// | along with Foobar; if not, write to the Free Software |
|
21 |
// | along with Foobar; if not, write to the Free Software |
|
| 22 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
22 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
// +------------------------------------------------------------------------------------------------------+
|
23 |
// +------------------------------------------------------------------------------------------------------+
|
| 24 |
// CVS : $Id: syndication.php,v 1.5.2.2 2007-07-25 09:45:07 jp_milcent Exp $
|
24 |
// CVS : $Id: syndication.php,v 1.5.2.3 2007-07-25 14:50:21 jp_milcent Exp $
|
| 25 |
/**
|
25 |
/**
|
| 26 |
* papyrus_bp - syndication.php
|
26 |
* papyrus_bp - syndication.php
|
| 27 |
*
|
27 |
*
|
| 28 |
* Description :
|
28 |
* Description :
|
| 29 |
*
|
29 |
*
|
| Line 31... |
Line 31... |
| 31 |
//Auteur original :
|
31 |
//Auteur original :
|
| 32 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
32 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
| 33 |
//Autres auteurs :
|
33 |
//Autres auteurs :
|
| 34 |
*@author Aucun
|
34 |
*@author Aucun
|
| 35 |
*@copyright Tela-Botanica 1999-2006
|
35 |
*@copyright Tela-Botanica 1999-2006
|
| 36 |
*@version $Revision: 1.5.2.2 $ $Date: 2007-07-25 09:45:07 $
|
36 |
*@version $Revision: 1.5.2.3 $ $Date: 2007-07-25 14:50:21 $
|
| 37 |
// +------------------------------------------------------------------------------------------------------+
|
37 |
// +------------------------------------------------------------------------------------------------------+
|
| 38 |
*/
|
38 |
*/
|
| Line 39... |
Line 39... |
| 39 |
|
39 |
|
| 40 |
// +------------------------------------------------------------------------------------------------------+
|
40 |
// +------------------------------------------------------------------------------------------------------+
|
| Line 138... |
Line 138... |
| 138 |
try {
|
138 |
try {
|
| 139 |
$feed = new XML_Feed_Parser(file_get_contents($url));
|
139 |
$feed = new XML_Feed_Parser(file_get_contents($url));
|
| 140 |
} catch (XML_Feed_Parser_Exception $e) {
|
140 |
} catch (XML_Feed_Parser_Exception $e) {
|
| 141 |
die('Le flux RSS est invalide : ' . $e->getMessage());
|
141 |
die('Le flux RSS est invalide : ' . $e->getMessage());
|
| 142 |
}
|
142 |
}
|
| - |
|
143 |
|
| 143 |
if ($options['template'] != '' && !file_exists($options['template'])) {
|
144 |
if ($options['template'] != '' && !file_exists($options['template'])) {
|
| 144 |
$i = 0 ;
|
145 |
$i = 0 ;
|
| 145 |
$res= '';
|
146 |
$res= '';
|
| 146 |
foreach ($feed as $item) {
|
147 |
foreach ($feed as $item) {
|
| 147 |
// Le test suivant pour savoir s il faut reduire l excendent de description
|
148 |
// Le test suivant pour savoir s il faut reduire l excendent de description
|
| Line 182... |
Line 183... |
| 182 |
}
|
183 |
}
|
| 183 |
// Gestion du titre
|
184 |
// Gestion du titre
|
| 184 |
if ( $options['titre'] == '' ) {
|
185 |
if ( $options['titre'] == '' ) {
|
| 185 |
$aso_site['titre'] = utf8_decode($feed->title);
|
186 |
$aso_site['titre'] = utf8_decode($feed->title);
|
| 186 |
} else if ( $options['titre'] != '0' ) {
|
187 |
} else if ( $options['titre'] != '0' ) {
|
| 187 |
$aso_site['titre'] = utf8_decode($options['titre']);
|
188 |
$aso_site['titre'] = $options['titre'];
|
| 188 |
}
|
189 |
}
|
| 189 |
// Gestion de l'url du site
|
190 |
// Gestion de l'url du site
|
| 190 |
if (isset($feed->link)) {
|
191 |
if (isset($feed->link)) {
|
| 191 |
$aso_site['url'] = htmlentities($feed->link);
|
192 |
$aso_site['url'] = htmlentities($feed->link);
|
| 192 |
}
|
193 |
}
|
| Line 195... |
Line 196... |
| 195 |
if ($options['nouvellefenetre'] == 1) {
|
196 |
if ($options['nouvellefenetre'] == 1) {
|
| 196 |
$aso_site['ext'] = true;
|
197 |
$aso_site['ext'] = true;
|
| 197 |
}
|
198 |
}
|
| 198 |
// Gestion des pages syndiquees
|
199 |
// Gestion des pages syndiquees
|
| 199 |
$i = 0;
|
200 |
$i = 0;
|
| 200 |
$nb_item = count($feed);
|
201 |
$nb_item = $feed->numberEntries;
|
| 201 |
foreach ($feed as $item) {
|
202 |
foreach ($feed as $item) {
|
| - |
|
203 |
//echo '<pre>'.print_r($item, true).'</pre>';
|
| 202 |
if ($options['nb'] != 0 && $nb_item >= $options['nb'] && $i >= $options['nb']) {
|
204 |
if ($options['nb'] != 0 && $nb_item >= $options['nb'] && $i >= $options['nb']) {
|
| 203 |
break;
|
205 |
break;
|
| 204 |
}
|
206 |
}
|
| 205 |
$i++;
|
207 |
$i++;
|
| 206 |
$aso_page = array();
|
208 |
$aso_page = array();
|
| 207 |
$aso_page['site'] = $aso_site;
|
209 |
$aso_page['site'] = $aso_site;
|
| 208 |
$aso_page['url'] = $item->link;
|
210 |
$aso_page['url'] = $item->link;
|
| 209 |
$aso_page['titre'] = utf8_decode($item->title);
|
211 |
$aso_page['titre'] = utf8_decode($item->title);
|
| 210 |
if (isset($item->pubdate)) {
|
- |
|
| 211 |
$aso_page['date'] = $item->pubdate;
|
212 |
$aso_page['date'] = $item->pubDate;
|
| 212 |
} elseif (isset($item->date)) {
|
- |
|
| 213 |
$aso_page['date'] = $item->date;
|
- |
|
| 214 |
} elseif (isset($item->date_timestamp)) {
|
- |
|
| 215 |
$aso_page['date'] = $item->date_timestamp;
|
- |
|
| 216 |
} else {
|
- |
|
| 217 |
$aso_page['date'] = '';
|
- |
|
| 218 |
}
|
- |
|
| 219 |
if ($options['formatdatepro']) {
|
213 |
if ($options['formatdatepro']) {
|
| 220 |
switch ($options['formatdatepro']) {
|
214 |
switch ($options['formatdatepro']) {
|
| 221 |
case 'jm' :
|
215 |
case 'jm' :
|
| 222 |
$aso_page['date'] = strftime('%d.%m', strtotime($aso_page['date']));
|
216 |
$aso_page['date'] = strftime('%d.%m', $aso_page['date']);
|
| 223 |
break;
|
217 |
break;
|
| 224 |
case 'jma' :
|
218 |
case 'jma' :
|
| 225 |
$aso_page['date'] = strftime('%d.%m.%Y', strtotime($aso_page['date']));
|
219 |
$aso_page['date'] = strftime('%d.%m.%Y', $aso_page['date']);
|
| 226 |
break;
|
220 |
break;
|
| 227 |
case 'jmh' :
|
221 |
case 'jmh' :
|
| 228 |
$aso_page['date'] = strftime('%d.%m %H:%M', strtotime($aso_page['date']));
|
222 |
$aso_page['date'] = strftime('%d.%m %H:%M', $aso_page['date']);
|
| 229 |
break;
|
223 |
break;
|
| 230 |
case 'jmah' :
|
224 |
case 'jmah' :
|
| 231 |
$aso_page['date'] = strftime('%d.%m.%Y %H:%M', strtotime($aso_page['date']));
|
225 |
$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
|
| 232 |
break;
|
226 |
break;
|
| 233 |
default :
|
227 |
default :
|
| 234 |
$aso_page['date'] = strftime('%d.%m.%Y %H:%M', strtotime($aso_page['date']));
|
228 |
$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
|
| 235 |
}
|
229 |
}
|
| 236 |
} else {
|
230 |
} else {
|
| 237 |
switch ($options['formatdate']) {
|
231 |
switch ($options['formatdate']) {
|
| 238 |
case 'jm' :
|
232 |
case 'jm' :
|
| 239 |
$aso_page['date'] = strftime('%d.%m', strtotime($aso_page['date']));
|
233 |
$aso_page['date'] = strftime('%d.%m', $aso_page['date']);
|
| 240 |
break;
|
234 |
break;
|
| 241 |
case 'jma' :
|
235 |
case 'jma' :
|
| 242 |
$aso_page['date'] = strftime('%d.%m.%Y', strtotime($aso_page['date']));
|
236 |
$aso_page['date'] = strftime('%d.%m.%Y', $aso_page['date']);
|
| 243 |
break;
|
237 |
break;
|
| 244 |
case 'jmh' :
|
238 |
case 'jmh' :
|
| 245 |
$aso_page['date'] = strftime('%d.%m %H:%M', strtotime($aso_page['date']));
|
239 |
$aso_page['date'] = strftime('%d.%m %H:%M', $aso_page['date']);
|
| 246 |
break;
|
240 |
break;
|
| 247 |
case 'jmah' :
|
241 |
case 'jmah' :
|
| 248 |
$aso_page['date'] = strftime('%d.%m.%Y %H:%M', strtotime($aso_page['date']));
|
242 |
$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
|
| 249 |
break;
|
243 |
break;
|
| 250 |
default :
|
244 |
default :
|
| 251 |
$aso_page['date'] = strftime('%d.%m.%Y %H:%M', strtotime($aso_page['date']));
|
245 |
$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
|
| 252 |
}
|
246 |
}
|
| 253 |
}
|
247 |
}
|
| 254 |
$aso_site['pages'][] = $aso_page;
|
248 |
$aso_site['pages'][] = $aso_page;
|
| 255 |
$GLOBALS['_SYNDICATION_']['pages'][strtotime($aso_page['date'])] = $aso_page;
|
249 |
$GLOBALS['_SYNDICATION_']['pages'][strtotime($aso_page['date'])] = $aso_page;
|
| 256 |
}
|
250 |
}
|
| Line 281... |
Line 275... |
| 281 |
}
|
275 |
}
|
| Line 282... |
Line 276... |
| 282 |
|
276 |
|
| 283 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
277 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
| 284 |
*
|
278 |
*
|
| - |
|
279 |
* $Log: not supported by cvs2svn $
|
| - |
|
280 |
* Revision 1.5.2.2 2007-07-25 09:45:07 jp_milcent
|
| - |
|
281 |
* Utilisation de XML_Feed_Parser de Pear pour l'applette Syndication.
|
| 285 |
* $Log: not supported by cvs2svn $
|
282 |
*
|
| 286 |
* Revision 1.5.2.1 2007-06-06 15:24:37 jp_milcent
|
283 |
* Revision 1.5.2.1 2007-06-06 15:24:37 jp_milcent
|
| 287 |
* Amélioration de la compatibilité avec les anciennes version des balises de l'applette syndication.
|
284 |
* Amélioration de la compatibilité avec les anciennes version des balises de l'applette syndication.
|
| 288 |
*
|
285 |
*
|
| 289 |
* Revision 1.5 2007-04-20 12:50:18 florian
|
286 |
* Revision 1.5 2007-04-20 12:50:18 florian
|