mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RSS
synced 2024-09-25 03:09:26 +00:00
Update RSS to add the ability to restrict per-namespace.
This commit is contained in:
parent
721dc2c237
commit
518d4b7a17
|
@ -18,6 +18,7 @@ $messages['en'] = array(
|
|||
'rss-fetch-nourl' => 'Fetch called without a URL!',
|
||||
'rss-invalid-url' => 'Not a valid URL: $1',
|
||||
'rss-parse-error' => 'Error parsing XML for RSS',
|
||||
'rss-ns-permission' => 'RSS is not allowed in this namespace',
|
||||
'rss-item' => '{{RSSPost | title = {{{title}}} | link = {{{link}}} | date = {{{date}}} | author = {{{author}}} }}',
|
||||
);
|
||||
|
||||
|
|
13
RSS.php
13
RSS.php
|
@ -51,13 +51,16 @@ $wgHooks['ParserFirstCallInit'][] = 'RSSHooks::parserInit';
|
|||
|
||||
$wgRSSCacheAge = 3600; // one hour
|
||||
$wgRSSCacheCompare = false; // Check cached content, if available, against remote.
|
||||
// $wgRSSCacheCompare should be set to false or a timeout
|
||||
// (less than $wgRSSCacheAge) after which a comparison will
|
||||
// be made.
|
||||
$wgRSSFetchTimeout = 5; // 5 second timeout
|
||||
// $wgRSSCacheCompare should be set to false or a timeout
|
||||
// (less than $wgRSSCacheAge) after which a comparison will
|
||||
// be made.
|
||||
$wgRSSFetchTimeout = 5; // 5 second timeout
|
||||
$wgRSSNamespaces = null; // Ignore the RSS tag in all but the namespaces listed here.
|
||||
// null (the default) means the <rss> tag can be used
|
||||
// anywhere.
|
||||
|
||||
// Agent to use for fetching feeds
|
||||
$wgRSSUserAgent = 'MediaWikiRSS/0.01 (+http://www.mediawiki.org/wiki/Extension:RSS) / MediaWiki RSS extension';
|
||||
$wgRSSUserAgent = 'MediaWikiRSS/0.02 (+http://www.mediawiki.org/wiki/Extension:RSS) / MediaWiki RSS extension';
|
||||
|
||||
// Proxy server to use for fetching feeds
|
||||
$wgRSSProxy = false;
|
||||
|
|
11
RSSHooks.php
11
RSSHooks.php
|
@ -20,7 +20,16 @@ class RSSHooks {
|
|||
* @param $frame Frame parser context
|
||||
*/
|
||||
static function renderRss( $input, $args, $parser, $frame ) {
|
||||
global $wgRSSCacheAge, $wgRSSCacheCompare;
|
||||
global $wgRSSCacheAge, $wgRSSCacheCompare, $wgRSSNamespaces;
|
||||
|
||||
if ( $wgRSSNamespaces !== null && is_array($wgRSSNamespaces) ) {
|
||||
$ns = $parser->getTitle()->getNamespace();
|
||||
$checkNS = array_flip($wgRSSNamespaces);
|
||||
|
||||
if( !isset( $checkNS[$ns] ) ) {
|
||||
return wfMsg( 'rss-ns-permission' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !Http::isValidURI( $input ) ) {
|
||||
return wfMsg( 'rss-invalid-url', htmlspecialchars( $input ) );
|
||||
|
|
Loading…
Reference in a new issue