function renderRow($row, $forFeed = false) { global $wgUser, $wgLang; $change = RecentChange::newFromRow($row); $change->counter = 0; //hack $usetemplate = $this->usetemplate; $templatetext = $this->templatetext; if (!$templatetext && $forFeed) { $templatetext = '{{{head}}}'; $usetemplate = true; } if (!$usetemplate) { #$pagelink = $this->skin->makeKnownLinkObj( $title ); $this->changelist->insertDateHeader($dummy, $row->rc_timestamp); #dummy call to suppress date headers $html = $this->changelist->recentChangesLine($change); return $html; } else { $params = array(); $params['namespace'] = $row->rc_namespace; $params['title'] = $row->rc_title; $title = $change->getTitle(); $params['pagename'] = $title->getPrefixedText(); $params['minor'] = $row->rc_minor ? 'true' : ''; $params['bot'] = $row->rc_bot ? 'true' : ''; $params['patrolled'] = $row->rc_patrolled ? 'true' : ''; $params['anon'] = $row->rc_user <= 0 ? 'true' : ''; #XXX: perhaps use (rc_user == rc_ip) instead? That would take care of entries from importing. $params['new'] = $row->rc_type == RC_NEW ? 'true' : ''; $params['type'] = $row->rc_type; $params['user'] = $row->rc_user_text; $params['rawtime'] = $row->rc_timestamp; $params['time'] = $wgLang->time($row->rc_timestamp, true, true); $params['date'] = $wgLang->date($row->rc_timestamp, true, true); $params['timeanddate'] = $wgLang->timeanddate($row->rc_timestamp, true, true); $params['old_len'] = $row->rc_old_len; $params['new_len'] = $row->rc_new_len; $params['old_rev'] = $row->rc_last_oldid; $params['new_rev'] = $row->rc_this_oldid; $diffq = $change->diffLinkTrail(false); $params['diff'] = $diffq ? $title->getFullURL($diffq) : ''; $permaq = "oldid=" . $row->rc_this_oldid; $params['permalink'] = $permaq ? $title->getFullURL($permaq) : ''; $params['comment'] = str_replace(array('{{', '}}', '|', '\''), array('{{', '}}', '|', '$#39;'), wfEscapeWikiText($row->rc_comment)); if (stripos($templatetext, '{{{content}}}') !== false || stripos($templatetext, '{{{head}}}') !== false) { $article = new Article($title, $row->rc_this_oldid); $t = $article->getContent(); //TODO: expand variables & templates first, so cut-off applies to effective content, // and extension tags from templates are stripped properly // this doesn't work though: $t = $this->templateparser->preprocess( $t, $this->title, new ParserOptions() ); //TODO: avoid magic categories, interwiki-links, etc $params['content'] = NewsRenderer::sanitizeWikiText($t, $this->templateparser); if (stripos($templatetext, '{{{head}}}') !== false) { $params['head'] = NewsRenderer::extractHead($params['content'], $title); } } $text = NewsRenderer::replaceVariables($this->templateparser, $templatetext, $params, $this->title); return $text; } }