本文整理汇总了PHP中Jaws_XSS::refilter方法的典型用法代码示例。如果您正苦于以下问题:PHP Jaws_XSS::refilter方法的具体用法?PHP Jaws_XSS::refilter怎么用?PHP Jaws_XSS::refilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jaws_XSS
的用法示例。
在下文中一共展示了Jaws_XSS::refilter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DisplayFeeds
/**
* Displays titles of the feed sites
*
* @access public
* @param int $id Feed site ID
* @return string XHTML content with all titles and links of feed sites
*/
function DisplayFeeds($id = 0)
{
if (empty($id)) {
$id = $this->gadget->registry->fetch('default_feed');
}
$model = $this->gadget->model->load('Feed');
$site = $model->GetFeed($id);
if (Jaws_Error::IsError($site) || empty($site) || $site['visible'] == 0) {
return false;
}
$tpl = $this->gadget->template->load('FeedReader.html');
$tpl->SetBlock('feedreader');
require_once JAWS_PATH . 'gadgets/FeedReader/include/XML_Feed.php';
$parser = new XML_Feed();
$parser->cache_time = $site['cache_time'];
$options = array();
$timeout = (int) $this->gadget->registry->fetch('connection_timeout', 'Settings');
$options['timeout'] = $timeout;
if ($this->gadget->registry->fetch('proxy_enabled', 'Settings') == 'true') {
if ($this->gadget->registry->fetch('proxy_auth', 'Settings') == 'true') {
$options['proxy_user'] = $this->gadget->registry->fetch('proxy_user', 'Settings');
$options['proxy_pass'] = $this->gadget->registry->fetch('proxy_pass', 'Settings');
}
$options['proxy_host'] = $this->gadget->registry->fetch('proxy_host', 'Settings');
$options['proxy_port'] = $this->gadget->registry->fetch('proxy_port', 'Settings');
}
$parser->setParams($options);
if (Jaws_Utils::is_writable(JAWS_DATA . 'feedcache')) {
$parser->cache_dir = JAWS_DATA . 'feedcache';
}
$res = $parser->fetch(Jaws_XSS::defilter($site['url']));
if (PEAR::isError($res)) {
$GLOBALS['log']->Log(JAWS_LOG_ERROR, '[' . $this->gadget->title . ']: ', _t('FEEDREADER_ERROR_CANT_FETCH', Jaws_XSS::refilter($site['url'])), '');
}
if (!isset($parser->feed)) {
return false;
}
$block = $site['view_type'] == 0 ? 'simple' : 'marquee';
$tpl->SetBlock("feedreader/{$block}");
$tpl->SetVariable('title', _t('FEEDREADER_ACTION_TITLE'));
switch ($site['title_view']) {
case 1:
$tpl->SetVariable('feed_title', Jaws_XSS::refilter($parser->feed['channel']['title']));
$tpl->SetVariable('feed_link', Jaws_XSS::refilter(isset($parser->feed['channel']['link']) ? $parser->feed['channel']['link'] : ''));
break;
case 2:
$tpl->SetVariable('feed_title', Jaws_XSS::refilter($site['title']));
$tpl->SetVariable('feed_link', Jaws_XSS::refilter(isset($parser->feed['channel']['link']) ? $parser->feed['channel']['link'] : ''));
break;
default:
}
$tpl->SetVariable('marquee_direction', $site['view_type'] == 2 ? 'down' : ($site['view_type'] == 3 ? 'left' : ($site['view_type'] == 4 ? 'right' : 'up')));
if (isset($parser->feed['items'])) {
foreach ($parser->feed['items'] as $index => $item) {
$tpl->SetBlock("feedreader/{$block}/item");
$tpl->SetVariable('title', Jaws_XSS::refilter($item['title']));
$tpl->SetVariable('href', isset($item['link']) ? Jaws_XSS::refilter($item['link']) : '');
$tpl->ParseBlock("feedreader/{$block}/item");
if ($site['count_entry'] > 0 && $site['count_entry'] <= $index + 1) {
break;
}
}
}
$tpl->ParseBlock("feedreader/{$block}");
$tpl->ParseBlock('feedreader');
return $tpl->Get();
}