<?php
// PukiWiki - Yet another WikiWikiWeb clone
-// $Id: showrss.inc.php,v 1.20 2006/05/05 04:25:28 henoheno Exp $
-// Id:showrss.inc.php,v 1.40 2003/03/18 11:52:58 hiro Exp
-// Copyright (C):
-// 2002-2006 PukiWiki Developers Team
+// showrss.inc.php
+// Copyright:
+// 2002-2016 PukiWiki Development Team
// 2002 PANDA <panda@arino.jp>
// (Original)hiro_do3ob@yahoo.co.jp
// License: GPL, same as PukiWiki
$class = ($template == '' || $template == 'default') ? 'ShowRSS_html' : 'ShowRSS_html_' . $template;
if (! is_numeric($cachehour))
- return '#showrss: Cache-lifetime seems not numeric: ' . htmlspecialchars($cachehour) . '<br />' . "\n";
+ return '#showrss: Cache-lifetime seems not numeric: ' . htmlsc($cachehour) . '<br />' . "\n";
if (! class_exists($class))
- return '#showrss: Template not found: ' . htmlspecialchars($template) . '<br />' . "\n";
+ return '#showrss: Template not found: ' . htmlsc($template) . '<br />' . "\n";
if (! is_url($uri))
- return '#showrss: Seems not URI: ' . htmlspecialchars($uri) . '<br />' . "\n";
+ return '#showrss: Seems not URI: ' . htmlsc($uri) . '<br />' . "\n";
list($rss, $time) = plugin_showrss_get_rss($uri, $cachehour);
if ($rss === FALSE) return '#showrss: Failed fetching RSS from the server<br />' . "\n";
function ShowRSS_html($rss)
{
+ $this->__construct($rss);
+ }
+ function __construct($rss)
+ {
foreach ($rss as $date=>$items) {
foreach ($items as $item) {
$link = $item['LINK'];
if ($time === NULL) {
// Newly get RSS
- $data = http_request($target);
+ $data = pkwk_http_request($target);
if ($data['rc'] !== 200)
return array(FALSE, 0);
// Detect encoding
$matches = array();
- if(preg_match('/<?xml [^>]*\bencoding="([a-z0-9-_]+)"/i', $buf, $matches)) {
+ if(preg_match('/<\?xml [^>]*\bencoding="([a-z0-9-_]+)"/i', $buf, $matches)) {
$this->encoding = $matches[1];
} else {
$this->encoding = mb_detect_encoding($buf);
function escape($str)
{
- // Unescape already-escaped chars (<, >, &, ...) in RSS body before htmlspecialchars()
+ // Unescape already-escaped chars (<, >, &, ...) in RSS body before htmlsc()
$str = strtr($str, array_flip(get_html_translation_table(ENT_COMPAT)));
// Escape
- $str = htmlspecialchars($str);
+ $str = htmlsc($str);
// Encoding conversion
$str = mb_convert_encoding($str, SOURCE_ENCODING, $this->encoding);
return trim($str);
return ($time == -1) ? UTIME : $time - LOCALZONE;
}
}
-?>