mediawiki-extensions-RSS/RSS.php

105 lines
3.7 KiB
PHP
Raw Normal View History

<?php
/**
* RSS-Feed MediaWiki extension
2010-07-23 14:14:05 +00:00
*
* @file
* @ingroup Extensions
* @version 2.20
* @author mutante, Daniel Kinzler, Rdb, Mafs, Thomas Gries, Alxndr, Chris Reigrut, K001
* @author Kellan Elliott-McCrea <kellan@protest.net> -- author of MagpieRSS
* @author Jeroen De Dauw
* @author Jack Phoenix <jack@countervandalism.net>
* @copyright © Kellan Elliott-McCrea <kellan@protest.net>
* @copyright © mutante, Daniel Kinzler, Rdb, Mafs, Thomas Gries, Alxndr, Chris Reigrut, K001
* @link http://www.mediawiki.org/wiki/Extension:RSS Documentation
*/
2010-07-23 14:14:05 +00:00
define( "EXTENSION_RSS_VERSION", "2.20 20130303" );
version 2.18 + squashed commit RSS changes fromSVN bump version number from 2.17 to 2.18 for the releas version removed 4 white spaces tabs. followed the advices of the code reviewer. removed an unwanted switch(true) structure removed switch case by an assoc array, removed unneeded http factory comments Wikinaut 2013-01-04 removed unneeded INSTALL text file new version 2.17 incl. code cosmetics. rebased on master bea4447d24ad33c115e64385ef8fc5a308b58188 2012-12-22 bear with me ! It's my first real-life commit to gerrit. Wikinaut, 2012-12-30 Catrope squashed these together per Wikinaut's request. List of commit summaries: adding the long-wanted date format attribute. implemented a date format equalising function, so that dates of RSS feeds are rendered in a common format. follow-up r111347 : adding escapeTemplateParameter around the user supplied optional date attribute fix for bug30377 : add a new parameter to limit the number of characters when rendering the channel item <description> follow-up r111350 . check if optional parameter isset and is_numeric, otherwise limit to the built-in default (30000) removed a wrong comment regarding PHP 5.3 function date_create_from_format, which is not suited to auto-detect a time string in any formats - only strtotime() can do it. follow-up r111350 r111351 . switch replaced by if elseif construct. name and behaviour change of wgRSSAllowedFeeds towgRSSUrlWhitelist. The wgRSSUrlWhitelist is _now_ empty by default which was not the case until this version. Admins who want to allow their users to insert arbitrary feed urls must now denote this expressly with an asterisk in quotes as whitelist array element. This is harmonised to the same method as recently introduced in E:EtherpadLite. The RELEASE NOTES file has been updated, updates to the MediaWiki manual page will follow soon. increased wgRSSFetchTimeout default from 5 to 15 seconds - many sites are too slow. v2.00 can parse ATOM feeds, at least some. This is a major improvement over pre-2.00 versions which only could read and parse RSS feeds but no ATOM feeds. Version 2.00 begins to keep care of namespaces in the XML. The parser still leaves room for further improvements. At least, E:RSS can now read E:WikiArticleFeeds generated RSS _and_ ATOM feeds. v2.01 fixed ATOM summary element was forgotten to be parsed. Added handling of basic HTML layout tags (p br b u i s) in feed descriptions, they are preserved in the wiki output after sanitizing. improved code legibility function namespacePrefixedQuery fix for ultra bug 30028 . The RSS extension can parse RSS and ATOM feeds of different flavours. The php xml dom xpath query uses now a namespace-safe method to find all elements like item (RSS, RDF) or entry (ATOM). Further fixed a hidden problem when the feed url was redirecting, this threw the Cannot parse RSS for XML error, which is now history. Introduced a new parameter wgRSSUrlNumberOfAllowedRedirects which defaults to zero, i.e. no redirects are allowed by default. See Manual page removed superfluous code for setting userAgent since r112466 function name typo correction. Version number update fix for bug34763 'RSS feed items (HTML) are not rendered as HTML but htmlescaped'; tolerated controlled regression bug30377 'feed item length limitation', because this now becomes very tricky when we allow some tags in order to close bug 34763. add tracking category feature (enabled by default). Each page using this extensions gets automatically the tracking category with MediaWiki:Rss-tracking-category name (= RSS). Tracking-Cat-Feature can be disabled, or a different MediaWiki message text can be assigned. Documentation of the switch is inline and follows on MediaWiki. follow up r113508 : escaped html tag brackets to make translaters happy beautifying the tracking category name adding casts. better ? removed the redundant code for handling tracking categories. By using '-' for the message text rss-tracking-category , this can be disabled easily. + Patchset 11 rebased on master + Patchset 12 wrapped commit message text lines version number bumped to 2.18 + Patchset 13 improved and updated README added history of the present version 2.18 + Patchset 14 white space fixes version number fixes Change-Id: I2d9724314f94c216650370071b31390c5c2c97fc
2012-02-13 01:39:24 +00:00
2010-10-20 18:28:47 +00:00
if ( !defined( 'MEDIAWIKI' ) ) {
die( "This is not a valid entry point.\n" );
}
2010-07-23 14:14:05 +00:00
// Extension credits that will show up on Special:Version
$wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
'name' => 'RSS feed',
'author' => array( 'Kellan Elliott-McCrea', 'mutante', 'Daniel Kinzler',
'Rdb', 'Mafs', 'Alxndr', 'Thomas Gries', 'Chris Reigrut',
'K001', 'Jack Phoenix', 'Jeroen De Dauw', 'Mark A. Hershberger'
),
version 2.18 + squashed commit RSS changes fromSVN bump version number from 2.17 to 2.18 for the releas version removed 4 white spaces tabs. followed the advices of the code reviewer. removed an unwanted switch(true) structure removed switch case by an assoc array, removed unneeded http factory comments Wikinaut 2013-01-04 removed unneeded INSTALL text file new version 2.17 incl. code cosmetics. rebased on master bea4447d24ad33c115e64385ef8fc5a308b58188 2012-12-22 bear with me ! It's my first real-life commit to gerrit. Wikinaut, 2012-12-30 Catrope squashed these together per Wikinaut's request. List of commit summaries: adding the long-wanted date format attribute. implemented a date format equalising function, so that dates of RSS feeds are rendered in a common format. follow-up r111347 : adding escapeTemplateParameter around the user supplied optional date attribute fix for bug30377 : add a new parameter to limit the number of characters when rendering the channel item <description> follow-up r111350 . check if optional parameter isset and is_numeric, otherwise limit to the built-in default (30000) removed a wrong comment regarding PHP 5.3 function date_create_from_format, which is not suited to auto-detect a time string in any formats - only strtotime() can do it. follow-up r111350 r111351 . switch replaced by if elseif construct. name and behaviour change of wgRSSAllowedFeeds towgRSSUrlWhitelist. The wgRSSUrlWhitelist is _now_ empty by default which was not the case until this version. Admins who want to allow their users to insert arbitrary feed urls must now denote this expressly with an asterisk in quotes as whitelist array element. This is harmonised to the same method as recently introduced in E:EtherpadLite. The RELEASE NOTES file has been updated, updates to the MediaWiki manual page will follow soon. increased wgRSSFetchTimeout default from 5 to 15 seconds - many sites are too slow. v2.00 can parse ATOM feeds, at least some. This is a major improvement over pre-2.00 versions which only could read and parse RSS feeds but no ATOM feeds. Version 2.00 begins to keep care of namespaces in the XML. The parser still leaves room for further improvements. At least, E:RSS can now read E:WikiArticleFeeds generated RSS _and_ ATOM feeds. v2.01 fixed ATOM summary element was forgotten to be parsed. Added handling of basic HTML layout tags (p br b u i s) in feed descriptions, they are preserved in the wiki output after sanitizing. improved code legibility function namespacePrefixedQuery fix for ultra bug 30028 . The RSS extension can parse RSS and ATOM feeds of different flavours. The php xml dom xpath query uses now a namespace-safe method to find all elements like item (RSS, RDF) or entry (ATOM). Further fixed a hidden problem when the feed url was redirecting, this threw the Cannot parse RSS for XML error, which is now history. Introduced a new parameter wgRSSUrlNumberOfAllowedRedirects which defaults to zero, i.e. no redirects are allowed by default. See Manual page removed superfluous code for setting userAgent since r112466 function name typo correction. Version number update fix for bug34763 'RSS feed items (HTML) are not rendered as HTML but htmlescaped'; tolerated controlled regression bug30377 'feed item length limitation', because this now becomes very tricky when we allow some tags in order to close bug 34763. add tracking category feature (enabled by default). Each page using this extensions gets automatically the tracking category with MediaWiki:Rss-tracking-category name (= RSS). Tracking-Cat-Feature can be disabled, or a different MediaWiki message text can be assigned. Documentation of the switch is inline and follows on MediaWiki. follow up r113508 : escaped html tag brackets to make translaters happy beautifying the tracking category name adding casts. better ? removed the redundant code for handling tracking categories. By using '-' for the message text rss-tracking-category , this can be disabled easily. + Patchset 11 rebased on master + Patchset 12 wrapped commit message text lines version number bumped to 2.18 + Patchset 13 improved and updated README added history of the present version 2.18 + Patchset 14 white space fixes version number fixes Change-Id: I2d9724314f94c216650370071b31390c5c2c97fc
2012-02-13 01:39:24 +00:00
'version' => EXTENSION_RSS_VERSION,
'url' => 'https://www.mediawiki.org/wiki/Extension:RSS',
'descriptionmsg' => 'rss-desc',
);
2010-07-23 14:14:05 +00:00
// Internationalization file and autoloadable classes
$dir = dirname( __FILE__ ) . '/';
$wgExtensionMessagesFiles['RSS'] = $dir . 'RSS.i18n.php';
$wgAutoloadClasses['RSSHooks'] = $dir . 'RSSHooks.php';
$wgAutoloadClasses['RSSParser'] = $dir . 'RSSParser.php';
version 2.18 + squashed commit RSS changes fromSVN bump version number from 2.17 to 2.18 for the releas version removed 4 white spaces tabs. followed the advices of the code reviewer. removed an unwanted switch(true) structure removed switch case by an assoc array, removed unneeded http factory comments Wikinaut 2013-01-04 removed unneeded INSTALL text file new version 2.17 incl. code cosmetics. rebased on master bea4447d24ad33c115e64385ef8fc5a308b58188 2012-12-22 bear with me ! It's my first real-life commit to gerrit. Wikinaut, 2012-12-30 Catrope squashed these together per Wikinaut's request. List of commit summaries: adding the long-wanted date format attribute. implemented a date format equalising function, so that dates of RSS feeds are rendered in a common format. follow-up r111347 : adding escapeTemplateParameter around the user supplied optional date attribute fix for bug30377 : add a new parameter to limit the number of characters when rendering the channel item <description> follow-up r111350 . check if optional parameter isset and is_numeric, otherwise limit to the built-in default (30000) removed a wrong comment regarding PHP 5.3 function date_create_from_format, which is not suited to auto-detect a time string in any formats - only strtotime() can do it. follow-up r111350 r111351 . switch replaced by if elseif construct. name and behaviour change of wgRSSAllowedFeeds towgRSSUrlWhitelist. The wgRSSUrlWhitelist is _now_ empty by default which was not the case until this version. Admins who want to allow their users to insert arbitrary feed urls must now denote this expressly with an asterisk in quotes as whitelist array element. This is harmonised to the same method as recently introduced in E:EtherpadLite. The RELEASE NOTES file has been updated, updates to the MediaWiki manual page will follow soon. increased wgRSSFetchTimeout default from 5 to 15 seconds - many sites are too slow. v2.00 can parse ATOM feeds, at least some. This is a major improvement over pre-2.00 versions which only could read and parse RSS feeds but no ATOM feeds. Version 2.00 begins to keep care of namespaces in the XML. The parser still leaves room for further improvements. At least, E:RSS can now read E:WikiArticleFeeds generated RSS _and_ ATOM feeds. v2.01 fixed ATOM summary element was forgotten to be parsed. Added handling of basic HTML layout tags (p br b u i s) in feed descriptions, they are preserved in the wiki output after sanitizing. improved code legibility function namespacePrefixedQuery fix for ultra bug 30028 . The RSS extension can parse RSS and ATOM feeds of different flavours. The php xml dom xpath query uses now a namespace-safe method to find all elements like item (RSS, RDF) or entry (ATOM). Further fixed a hidden problem when the feed url was redirecting, this threw the Cannot parse RSS for XML error, which is now history. Introduced a new parameter wgRSSUrlNumberOfAllowedRedirects which defaults to zero, i.e. no redirects are allowed by default. See Manual page removed superfluous code for setting userAgent since r112466 function name typo correction. Version number update fix for bug34763 'RSS feed items (HTML) are not rendered as HTML but htmlescaped'; tolerated controlled regression bug30377 'feed item length limitation', because this now becomes very tricky when we allow some tags in order to close bug 34763. add tracking category feature (enabled by default). Each page using this extensions gets automatically the tracking category with MediaWiki:Rss-tracking-category name (= RSS). Tracking-Cat-Feature can be disabled, or a different MediaWiki message text can be assigned. Documentation of the switch is inline and follows on MediaWiki. follow up r113508 : escaped html tag brackets to make translaters happy beautifying the tracking category name adding casts. better ? removed the redundant code for handling tracking categories. By using '-' for the message text rss-tracking-category , this can be disabled easily. + Patchset 11 rebased on master + Patchset 12 wrapped commit message text lines version number bumped to 2.18 + Patchset 13 improved and updated README added history of the present version 2.18 + Patchset 14 white space fixes version number fixes Change-Id: I2d9724314f94c216650370071b31390c5c2c97fc
2012-02-13 01:39:24 +00:00
$wgAutoloadClasses['RSSUtils'] = $dir . 'RSSParser.php';
$wgAutoloadClasses['RSSData'] = $dir . 'RSSData.php';
$wgHooks['ParserFirstCallInit'][] = 'RSSHooks::parserInit';
version 2.18 + squashed commit RSS changes fromSVN bump version number from 2.17 to 2.18 for the releas version removed 4 white spaces tabs. followed the advices of the code reviewer. removed an unwanted switch(true) structure removed switch case by an assoc array, removed unneeded http factory comments Wikinaut 2013-01-04 removed unneeded INSTALL text file new version 2.17 incl. code cosmetics. rebased on master bea4447d24ad33c115e64385ef8fc5a308b58188 2012-12-22 bear with me ! It's my first real-life commit to gerrit. Wikinaut, 2012-12-30 Catrope squashed these together per Wikinaut's request. List of commit summaries: adding the long-wanted date format attribute. implemented a date format equalising function, so that dates of RSS feeds are rendered in a common format. follow-up r111347 : adding escapeTemplateParameter around the user supplied optional date attribute fix for bug30377 : add a new parameter to limit the number of characters when rendering the channel item <description> follow-up r111350 . check if optional parameter isset and is_numeric, otherwise limit to the built-in default (30000) removed a wrong comment regarding PHP 5.3 function date_create_from_format, which is not suited to auto-detect a time string in any formats - only strtotime() can do it. follow-up r111350 r111351 . switch replaced by if elseif construct. name and behaviour change of wgRSSAllowedFeeds towgRSSUrlWhitelist. The wgRSSUrlWhitelist is _now_ empty by default which was not the case until this version. Admins who want to allow their users to insert arbitrary feed urls must now denote this expressly with an asterisk in quotes as whitelist array element. This is harmonised to the same method as recently introduced in E:EtherpadLite. The RELEASE NOTES file has been updated, updates to the MediaWiki manual page will follow soon. increased wgRSSFetchTimeout default from 5 to 15 seconds - many sites are too slow. v2.00 can parse ATOM feeds, at least some. This is a major improvement over pre-2.00 versions which only could read and parse RSS feeds but no ATOM feeds. Version 2.00 begins to keep care of namespaces in the XML. The parser still leaves room for further improvements. At least, E:RSS can now read E:WikiArticleFeeds generated RSS _and_ ATOM feeds. v2.01 fixed ATOM summary element was forgotten to be parsed. Added handling of basic HTML layout tags (p br b u i s) in feed descriptions, they are preserved in the wiki output after sanitizing. improved code legibility function namespacePrefixedQuery fix for ultra bug 30028 . The RSS extension can parse RSS and ATOM feeds of different flavours. The php xml dom xpath query uses now a namespace-safe method to find all elements like item (RSS, RDF) or entry (ATOM). Further fixed a hidden problem when the feed url was redirecting, this threw the Cannot parse RSS for XML error, which is now history. Introduced a new parameter wgRSSUrlNumberOfAllowedRedirects which defaults to zero, i.e. no redirects are allowed by default. See Manual page removed superfluous code for setting userAgent since r112466 function name typo correction. Version number update fix for bug34763 'RSS feed items (HTML) are not rendered as HTML but htmlescaped'; tolerated controlled regression bug30377 'feed item length limitation', because this now becomes very tricky when we allow some tags in order to close bug 34763. add tracking category feature (enabled by default). Each page using this extensions gets automatically the tracking category with MediaWiki:Rss-tracking-category name (= RSS). Tracking-Cat-Feature can be disabled, or a different MediaWiki message text can be assigned. Documentation of the switch is inline and follows on MediaWiki. follow up r113508 : escaped html tag brackets to make translaters happy beautifying the tracking category name adding casts. better ? removed the redundant code for handling tracking categories. By using '-' for the message text rss-tracking-category , this can be disabled easily. + Patchset 11 rebased on master + Patchset 12 wrapped commit message text lines version number bumped to 2.18 + Patchset 13 improved and updated README added history of the present version 2.18 + Patchset 14 white space fixes version number fixes Change-Id: I2d9724314f94c216650370071b31390c5c2c97fc
2012-02-13 01:39:24 +00:00
// one hour
$wgRSSCacheAge = 3600;
// 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.
version 2.18 + squashed commit RSS changes fromSVN bump version number from 2.17 to 2.18 for the releas version removed 4 white spaces tabs. followed the advices of the code reviewer. removed an unwanted switch(true) structure removed switch case by an assoc array, removed unneeded http factory comments Wikinaut 2013-01-04 removed unneeded INSTALL text file new version 2.17 incl. code cosmetics. rebased on master bea4447d24ad33c115e64385ef8fc5a308b58188 2012-12-22 bear with me ! It's my first real-life commit to gerrit. Wikinaut, 2012-12-30 Catrope squashed these together per Wikinaut's request. List of commit summaries: adding the long-wanted date format attribute. implemented a date format equalising function, so that dates of RSS feeds are rendered in a common format. follow-up r111347 : adding escapeTemplateParameter around the user supplied optional date attribute fix for bug30377 : add a new parameter to limit the number of characters when rendering the channel item <description> follow-up r111350 . check if optional parameter isset and is_numeric, otherwise limit to the built-in default (30000) removed a wrong comment regarding PHP 5.3 function date_create_from_format, which is not suited to auto-detect a time string in any formats - only strtotime() can do it. follow-up r111350 r111351 . switch replaced by if elseif construct. name and behaviour change of wgRSSAllowedFeeds towgRSSUrlWhitelist. The wgRSSUrlWhitelist is _now_ empty by default which was not the case until this version. Admins who want to allow their users to insert arbitrary feed urls must now denote this expressly with an asterisk in quotes as whitelist array element. This is harmonised to the same method as recently introduced in E:EtherpadLite. The RELEASE NOTES file has been updated, updates to the MediaWiki manual page will follow soon. increased wgRSSFetchTimeout default from 5 to 15 seconds - many sites are too slow. v2.00 can parse ATOM feeds, at least some. This is a major improvement over pre-2.00 versions which only could read and parse RSS feeds but no ATOM feeds. Version 2.00 begins to keep care of namespaces in the XML. The parser still leaves room for further improvements. At least, E:RSS can now read E:WikiArticleFeeds generated RSS _and_ ATOM feeds. v2.01 fixed ATOM summary element was forgotten to be parsed. Added handling of basic HTML layout tags (p br b u i s) in feed descriptions, they are preserved in the wiki output after sanitizing. improved code legibility function namespacePrefixedQuery fix for ultra bug 30028 . The RSS extension can parse RSS and ATOM feeds of different flavours. The php xml dom xpath query uses now a namespace-safe method to find all elements like item (RSS, RDF) or entry (ATOM). Further fixed a hidden problem when the feed url was redirecting, this threw the Cannot parse RSS for XML error, which is now history. Introduced a new parameter wgRSSUrlNumberOfAllowedRedirects which defaults to zero, i.e. no redirects are allowed by default. See Manual page removed superfluous code for setting userAgent since r112466 function name typo correction. Version number update fix for bug34763 'RSS feed items (HTML) are not rendered as HTML but htmlescaped'; tolerated controlled regression bug30377 'feed item length limitation', because this now becomes very tricky when we allow some tags in order to close bug 34763. add tracking category feature (enabled by default). Each page using this extensions gets automatically the tracking category with MediaWiki:Rss-tracking-category name (= RSS). Tracking-Cat-Feature can be disabled, or a different MediaWiki message text can be assigned. Documentation of the switch is inline and follows on MediaWiki. follow up r113508 : escaped html tag brackets to make translaters happy beautifying the tracking category name adding casts. better ? removed the redundant code for handling tracking categories. By using '-' for the message text rss-tracking-category , this can be disabled easily. + Patchset 11 rebased on master + Patchset 12 wrapped commit message text lines version number bumped to 2.18 + Patchset 13 improved and updated README added history of the present version 2.18 + Patchset 14 white space fixes version number fixes Change-Id: I2d9724314f94c216650370071b31390c5c2c97fc
2012-02-13 01:39:24 +00:00
// for debugging set $wgRSSCacheCompare = 1;
$wgRSSCacheCompare = false;
version 2.18 + squashed commit RSS changes fromSVN bump version number from 2.17 to 2.18 for the releas version removed 4 white spaces tabs. followed the advices of the code reviewer. removed an unwanted switch(true) structure removed switch case by an assoc array, removed unneeded http factory comments Wikinaut 2013-01-04 removed unneeded INSTALL text file new version 2.17 incl. code cosmetics. rebased on master bea4447d24ad33c115e64385ef8fc5a308b58188 2012-12-22 bear with me ! It's my first real-life commit to gerrit. Wikinaut, 2012-12-30 Catrope squashed these together per Wikinaut's request. List of commit summaries: adding the long-wanted date format attribute. implemented a date format equalising function, so that dates of RSS feeds are rendered in a common format. follow-up r111347 : adding escapeTemplateParameter around the user supplied optional date attribute fix for bug30377 : add a new parameter to limit the number of characters when rendering the channel item <description> follow-up r111350 . check if optional parameter isset and is_numeric, otherwise limit to the built-in default (30000) removed a wrong comment regarding PHP 5.3 function date_create_from_format, which is not suited to auto-detect a time string in any formats - only strtotime() can do it. follow-up r111350 r111351 . switch replaced by if elseif construct. name and behaviour change of wgRSSAllowedFeeds towgRSSUrlWhitelist. The wgRSSUrlWhitelist is _now_ empty by default which was not the case until this version. Admins who want to allow their users to insert arbitrary feed urls must now denote this expressly with an asterisk in quotes as whitelist array element. This is harmonised to the same method as recently introduced in E:EtherpadLite. The RELEASE NOTES file has been updated, updates to the MediaWiki manual page will follow soon. increased wgRSSFetchTimeout default from 5 to 15 seconds - many sites are too slow. v2.00 can parse ATOM feeds, at least some. This is a major improvement over pre-2.00 versions which only could read and parse RSS feeds but no ATOM feeds. Version 2.00 begins to keep care of namespaces in the XML. The parser still leaves room for further improvements. At least, E:RSS can now read E:WikiArticleFeeds generated RSS _and_ ATOM feeds. v2.01 fixed ATOM summary element was forgotten to be parsed. Added handling of basic HTML layout tags (p br b u i s) in feed descriptions, they are preserved in the wiki output after sanitizing. improved code legibility function namespacePrefixedQuery fix for ultra bug 30028 . The RSS extension can parse RSS and ATOM feeds of different flavours. The php xml dom xpath query uses now a namespace-safe method to find all elements like item (RSS, RDF) or entry (ATOM). Further fixed a hidden problem when the feed url was redirecting, this threw the Cannot parse RSS for XML error, which is now history. Introduced a new parameter wgRSSUrlNumberOfAllowedRedirects which defaults to zero, i.e. no redirects are allowed by default. See Manual page removed superfluous code for setting userAgent since r112466 function name typo correction. Version number update fix for bug34763 'RSS feed items (HTML) are not rendered as HTML but htmlescaped'; tolerated controlled regression bug30377 'feed item length limitation', because this now becomes very tricky when we allow some tags in order to close bug 34763. add tracking category feature (enabled by default). Each page using this extensions gets automatically the tracking category with MediaWiki:Rss-tracking-category name (= RSS). Tracking-Cat-Feature can be disabled, or a different MediaWiki message text can be assigned. Documentation of the switch is inline and follows on MediaWiki. follow up r113508 : escaped html tag brackets to make translaters happy beautifying the tracking category name adding casts. better ? removed the redundant code for handling tracking categories. By using '-' for the message text rss-tracking-category , this can be disabled easily. + Patchset 11 rebased on master + Patchset 12 wrapped commit message text lines version number bumped to 2.18 + Patchset 13 improved and updated README added history of the present version 2.18 + Patchset 14 white space fixes version number fixes Change-Id: I2d9724314f94c216650370071b31390c5c2c97fc
2012-02-13 01:39:24 +00:00
// 15 second timeout
$wgRSSFetchTimeout = 15;
// Ignore the RSS tag in all but the namespaces listed here.
// null (the default) means the <rss> tag can be used anywhere.
$wgRSSNamespaces = null;
version 2.18 + squashed commit RSS changes fromSVN bump version number from 2.17 to 2.18 for the releas version removed 4 white spaces tabs. followed the advices of the code reviewer. removed an unwanted switch(true) structure removed switch case by an assoc array, removed unneeded http factory comments Wikinaut 2013-01-04 removed unneeded INSTALL text file new version 2.17 incl. code cosmetics. rebased on master bea4447d24ad33c115e64385ef8fc5a308b58188 2012-12-22 bear with me ! It's my first real-life commit to gerrit. Wikinaut, 2012-12-30 Catrope squashed these together per Wikinaut's request. List of commit summaries: adding the long-wanted date format attribute. implemented a date format equalising function, so that dates of RSS feeds are rendered in a common format. follow-up r111347 : adding escapeTemplateParameter around the user supplied optional date attribute fix for bug30377 : add a new parameter to limit the number of characters when rendering the channel item <description> follow-up r111350 . check if optional parameter isset and is_numeric, otherwise limit to the built-in default (30000) removed a wrong comment regarding PHP 5.3 function date_create_from_format, which is not suited to auto-detect a time string in any formats - only strtotime() can do it. follow-up r111350 r111351 . switch replaced by if elseif construct. name and behaviour change of wgRSSAllowedFeeds towgRSSUrlWhitelist. The wgRSSUrlWhitelist is _now_ empty by default which was not the case until this version. Admins who want to allow their users to insert arbitrary feed urls must now denote this expressly with an asterisk in quotes as whitelist array element. This is harmonised to the same method as recently introduced in E:EtherpadLite. The RELEASE NOTES file has been updated, updates to the MediaWiki manual page will follow soon. increased wgRSSFetchTimeout default from 5 to 15 seconds - many sites are too slow. v2.00 can parse ATOM feeds, at least some. This is a major improvement over pre-2.00 versions which only could read and parse RSS feeds but no ATOM feeds. Version 2.00 begins to keep care of namespaces in the XML. The parser still leaves room for further improvements. At least, E:RSS can now read E:WikiArticleFeeds generated RSS _and_ ATOM feeds. v2.01 fixed ATOM summary element was forgotten to be parsed. Added handling of basic HTML layout tags (p br b u i s) in feed descriptions, they are preserved in the wiki output after sanitizing. improved code legibility function namespacePrefixedQuery fix for ultra bug 30028 . The RSS extension can parse RSS and ATOM feeds of different flavours. The php xml dom xpath query uses now a namespace-safe method to find all elements like item (RSS, RDF) or entry (ATOM). Further fixed a hidden problem when the feed url was redirecting, this threw the Cannot parse RSS for XML error, which is now history. Introduced a new parameter wgRSSUrlNumberOfAllowedRedirects which defaults to zero, i.e. no redirects are allowed by default. See Manual page removed superfluous code for setting userAgent since r112466 function name typo correction. Version number update fix for bug34763 'RSS feed items (HTML) are not rendered as HTML but htmlescaped'; tolerated controlled regression bug30377 'feed item length limitation', because this now becomes very tricky when we allow some tags in order to close bug 34763. add tracking category feature (enabled by default). Each page using this extensions gets automatically the tracking category with MediaWiki:Rss-tracking-category name (= RSS). Tracking-Cat-Feature can be disabled, or a different MediaWiki message text can be assigned. Documentation of the switch is inline and follows on MediaWiki. follow up r113508 : escaped html tag brackets to make translaters happy beautifying the tracking category name adding casts. better ? removed the redundant code for handling tracking categories. By using '-' for the message text rss-tracking-category , this can be disabled easily. + Patchset 11 rebased on master + Patchset 12 wrapped commit message text lines version number bumped to 2.18 + Patchset 13 improved and updated README added history of the present version 2.18 + Patchset 14 white space fixes version number fixes Change-Id: I2d9724314f94c216650370071b31390c5c2c97fc
2012-02-13 01:39:24 +00:00
// Whitelist of allowed RSS Urls
//
// If there are items in the array, and the user supplied URL is not in the array,
// the url will not be allowed
//
// Urls are case-sensitively tested against values in the array.
// They must exactly match including any trailing "/" character.
//
// Warning: Allowing all urls (not setting a whitelist)
// may be a security concern.
//
// an empty or non-existent array means: no whitelist defined
// this is the default: an empty whitelist. No servers are allowed by default.
$wgRSSUrlWhitelist = array();
// include "*" if you expressly want to allow all urls (you should not do this)
// $wgRSSUrlWhitelist = array( "*" );
// Maximum number of redirects to follow (defaults to 0)
// Note: this should only be used when the target URLs are trusted,
// to avoid attacks on intranet services accessible by HTTP.
$wgRSSUrlNumberOfAllowedRedirects = 0;
// Agent to use for fetching feeds
$wgRSSUserAgent = "MediaWikiRSS/" . strtok( EXTENSION_RSS_VERSION, " " ) .
" (+http://www.mediawiki.org/wiki/Extension:RSS) / MediaWiki RSS extension";
// Proxy server to use for fetching feeds
$wgRSSProxy = false;
version 2.18 + squashed commit RSS changes fromSVN bump version number from 2.17 to 2.18 for the releas version removed 4 white spaces tabs. followed the advices of the code reviewer. removed an unwanted switch(true) structure removed switch case by an assoc array, removed unneeded http factory comments Wikinaut 2013-01-04 removed unneeded INSTALL text file new version 2.17 incl. code cosmetics. rebased on master bea4447d24ad33c115e64385ef8fc5a308b58188 2012-12-22 bear with me ! It's my first real-life commit to gerrit. Wikinaut, 2012-12-30 Catrope squashed these together per Wikinaut's request. List of commit summaries: adding the long-wanted date format attribute. implemented a date format equalising function, so that dates of RSS feeds are rendered in a common format. follow-up r111347 : adding escapeTemplateParameter around the user supplied optional date attribute fix for bug30377 : add a new parameter to limit the number of characters when rendering the channel item <description> follow-up r111350 . check if optional parameter isset and is_numeric, otherwise limit to the built-in default (30000) removed a wrong comment regarding PHP 5.3 function date_create_from_format, which is not suited to auto-detect a time string in any formats - only strtotime() can do it. follow-up r111350 r111351 . switch replaced by if elseif construct. name and behaviour change of wgRSSAllowedFeeds towgRSSUrlWhitelist. The wgRSSUrlWhitelist is _now_ empty by default which was not the case until this version. Admins who want to allow their users to insert arbitrary feed urls must now denote this expressly with an asterisk in quotes as whitelist array element. This is harmonised to the same method as recently introduced in E:EtherpadLite. The RELEASE NOTES file has been updated, updates to the MediaWiki manual page will follow soon. increased wgRSSFetchTimeout default from 5 to 15 seconds - many sites are too slow. v2.00 can parse ATOM feeds, at least some. This is a major improvement over pre-2.00 versions which only could read and parse RSS feeds but no ATOM feeds. Version 2.00 begins to keep care of namespaces in the XML. The parser still leaves room for further improvements. At least, E:RSS can now read E:WikiArticleFeeds generated RSS _and_ ATOM feeds. v2.01 fixed ATOM summary element was forgotten to be parsed. Added handling of basic HTML layout tags (p br b u i s) in feed descriptions, they are preserved in the wiki output after sanitizing. improved code legibility function namespacePrefixedQuery fix for ultra bug 30028 . The RSS extension can parse RSS and ATOM feeds of different flavours. The php xml dom xpath query uses now a namespace-safe method to find all elements like item (RSS, RDF) or entry (ATOM). Further fixed a hidden problem when the feed url was redirecting, this threw the Cannot parse RSS for XML error, which is now history. Introduced a new parameter wgRSSUrlNumberOfAllowedRedirects which defaults to zero, i.e. no redirects are allowed by default. See Manual page removed superfluous code for setting userAgent since r112466 function name typo correction. Version number update fix for bug34763 'RSS feed items (HTML) are not rendered as HTML but htmlescaped'; tolerated controlled regression bug30377 'feed item length limitation', because this now becomes very tricky when we allow some tags in order to close bug 34763. add tracking category feature (enabled by default). Each page using this extensions gets automatically the tracking category with MediaWiki:Rss-tracking-category name (= RSS). Tracking-Cat-Feature can be disabled, or a different MediaWiki message text can be assigned. Documentation of the switch is inline and follows on MediaWiki. follow up r113508 : escaped html tag brackets to make translaters happy beautifying the tracking category name adding casts. better ? removed the redundant code for handling tracking categories. By using '-' for the message text rss-tracking-category , this can be disabled easily. + Patchset 11 rebased on master + Patchset 12 wrapped commit message text lines version number bumped to 2.18 + Patchset 13 improved and updated README added history of the present version 2.18 + Patchset 14 white space fixes version number fixes Change-Id: I2d9724314f94c216650370071b31390c5c2c97fc
2012-02-13 01:39:24 +00:00
// default date format of item publication dates see http://www.php.net/date
$wgRSSDateDefaultFormat = "(Y-m-d H:i:s)";
// limit the number of characters in the item description
// or set to false for unlimited length.
// THIS IS CURRENTLY NOT WORKING (bug 30377)
$wgRSSItemMaxLength = false;
// You can choose to allow active links in feed items; default: false
$wgRSSAllowLinkTag = false;
// If you want to allow images (HTML <img> tag) in RSS feeds; default: false
$wgRSSAllowImageTag = false;