# Extension:TransformChanges
# - See http://www.mediawiki.org/Extension:TransformChanges for installation and usage details
# - Licenced under LGPL (http://www.gnu.org/copyleft/lesser.html)
if (!defined('MEDIAWIKI')) die('Not an entry point.');
define('TRANSFORMCHANGES_VERSION','1.0.7, 2007-09-08');
$wgExtensionCredits['other'][] = array(
'name' => 'TransformChanges',
'author' => '[http://www.organicdesign.co.nz/nad User:Nad]',
'description' => 'Makes recent-changes and watchlists render in nice columns for easier reading.',
'url' => 'http://www.organicdesign.co.nz/Extension:TransformChanges',
'version' => TRANSFORMCHANGES_VERSION
);
# Disable enhanced recent changes
$wgExtensionFunctions[] = 'wfSetupTransformChanges';
function wfSetupTransformChanges() {
global $wgUser;
$wgUser->setOption('usenewrc',false);
}
$wgHooks['SpecialPageExecuteAfterPage'][] = 'wfTransformChanges';
function wfTransformChanges() {
global $wgOut;
$title = $wgOut->getPageTitle();
if ($title != wfMsgForContent('recentchanges') && $title != wfMsgForContent('watchlist')) return true;
$text =& $wgOut->mBodytext;
$text = preg_replace('|(\\s*)?
(.+?)
\\s*()- |s','$3
- ',$text);
$text = preg_replace_callback('||s','wfTransformChangesUL',$text);
return true;
}
function wfTransformChangesUL($match) {
global $wgTransformChangesRow;
$wgTransformChangesRow = 0;
$rows = preg_replace_callback('|
- (.+?)
|s','wfTransformChangesLI',$match[1]);
return "";
}
function wfTransformChangesLI($match) {
global $wgTransformChangesRow,$wgSimpleSecurity;
$wgTransformChangesRow = $wgTransformChangesRow == 'even' ? 'odd' : 'even';
list(,$date,$text) = $match;
$cols = array('title','comment');
$ncols = count($cols);
$row = '';
$error = 'Error: match failed! | ';
if ($date) {
$row = "| $date |
\n";
$wgTransformChangesRow = 'even';
}
$row .= "";
if (preg_match('|^(.*?); (\\d+:\\d+)(.+?)().+?(\\(.+?\\))|',$user,$m)) {
# Remove talk for email or IP users and make user lowercase
list(,$user,$talk) = $m;
if (ereg('@',$user) || !eregi('[a-z]',$user)) { $talk = ''; $user = strtolower($user); }
}
if (preg_match('|\\((.+)\\)|',$comment,$m)) $comment = $m[1];
$allowed = true;
if (preg_match('|title="(.+?)"|',$title,$m) && is_object($wgSimpleSecurity)) {
# Only show row if ok by SimpleSecurity extension
$t = Title::newFromText($m[1]);
$allowed = $wgSimpleSecurity->validateTitle('view',$t);
}
if ($allowed)
{
$other1 = 'user';
$other2 = 'info';
foreach ($cols as $col)
{
if ($col == 'title')
{
$row .= "{$$col} by {$$other1} {$$other2} | ";
}
else
{
$row .= "{$$col} | ";
}
}
}
} else $row = $error;
$row .= "
\n";
return $row;
}
?>
Parse error: syntax error, unexpected T_NAMESPACE, expecting T_STRING in /home/shift/public_html/wiki/includes/Namespace.php on line 44