mediawiki-extensions-RSS/RSS.php
Mark A. Hershberger 3aa74a03f8 Re Roan's new review on IRC yesterday:
* Add function documentation that I should have written before.
* Create separate RSSParser class to clean up RSS.php
* Create separate RSSHooks class to handle parser initialization and
  public interface for parser to use.
* Move User Agent definition to $wgRSSUserAgent from a define.
* Eliminate references to $wgRSSUseGzip (since were using MW's
  internal HTTP client, it didn't do anything anyway, ATM).

Re Tim's emailed review (discovered yesterday):
* Switch to DOMXPath::query() from DOMXPath::evaluate() at Tim's
  suggestion.
* Move highlighting callback to its own class, RSSHighlighter, so that
  it works as a callback without create_function() and other mess.
2010-11-04 23:19:00 +00:00

65 lines
2 KiB
PHP

<?php
/**
* RSS-Feed MediaWiki extension
*
* @file
* @ingroup Extensions
* @version 1.7
* @author mutante, Daniel Kinzler, Rdb, Mafs, 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, Alxndr, Chris Reigrut, K001
* @link http://www.mediawiki.org/wiki/Extension:RSS Documentation
*/
if ( !defined( 'MEDIAWIKI' ) ) {
die( "This is not a valid entry point.\n" );
}
// Agent to use for fetching feeds
$wgRSSUserAgent='MediaWikiRSS/0.01 (+http://www.mediawiki.org/wiki/Extension:RSS) / MediaWiki RSS extension';
// Extension credits that will show up on Special:Version
$wgExtensionCredits['parserhook'][] = array(
'name' => 'RSS feed',
'author' => array(
'Kellan Elliott-McCrea',
'mutante',
'Daniel Kinzler',
'Rdb',
'Mafs',
'Alxndr',
'Wikinaut',
'Chris Reigrut',
'K001',
'Jack Phoenix',
'Jeroen De Dauw',
'Mark A. Hershberger'
),
'version' => '1.8',
'url' => 'http://www.mediawiki.org/wiki/Extension:RSS',
'descriptionmsg' => 'rss-desc',
);
// Internationalization file and autoloadable classes
$dir = dirname( __FILE__ ) . '/';
$wgExtensionMessagesFiles['RSS'] = $dir . 'RSS.i18n.php';
$wgAutoloadClasses['RSSHooks'] = $dir . 'RSSHooks.php';
$wgAutoloadClasses['RSSParser'] = $dir . 'RSSParser.php';
$wgAutoloadClasses['RSSData'] = $dir . 'RSSData.php';
$wgHooks['ParserFirstCallInit'][] = 'RSSHooks::parserInit';
$wgRSSCacheAge = 3600; // one hour
$wgRSSCacheFreshOnly = false;
$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.
$wgRSSOutputEncoding = 'ISO-8859-1';
$wgRSSInputEncoding = null;
$wgRSSDetectEncoding = true;
$wgRSSFetchTimeout = 5; // 5 second timeout