本文整理汇总了PHP中RecentChange::newFromCurRow方法的典型用法代码示例。如果您正苦于以下问题:PHP RecentChange::newFromCurRow方法的具体用法?PHP RecentChange::newFromCurRow怎么用?PHP RecentChange::newFromCurRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecentChange
的用法示例。
在下文中一共展示了RecentChange::newFromCurRow方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doEdit
function doEdit($edit)
{
// create "fake" EditPage
$editor = (object) array('textbox1' => isset($edit['text']) ? $edit['text'] : '');
// try to get section name
MyHome::getSectionName($editor, '', !empty($edit['section']) ? $edit['section'] : false, $errno);
// create "fake" RecentChange object
$row = (object) array('rev_timestamp' => time(), 'rev_user' => 1, 'rev_user_text' => 'test', 'page_namespace' => NS_MAIN, 'page_title' => 'Test', 'rev_comment' => isset($edit['comment']) ? $edit['comment'] : '', 'rev_minor_edit' => true, 'page_is_new' => !empty($edit['is_new']), 'page_id' => 1, 'rev_id' => 1, 'rc_id' => 1, 'rc_patrolled' => 1, 'rc_old_len' => 1, 'rc_new_len' => 1, 'rc_deleted' => 1, 'rc_timestamp' => time());
$rc = RecentChange::newFromCurRow($row);
// call MyHome to add its data to rc object and Wikia vars
MyHome::storeInRecentChanges($rc);
$data = Wikia::getVar('rc_data');
unset($data['articleComment']);
return $data;
}
示例2: wfSpecialRecentchangeslinked
/**
* Entrypoint
* @param string $par parent page we will look at
*/
function wfSpecialRecentchangeslinked($par = NULL)
{
global $wgUser, $wgOut, $wgLang, $wgContLang, $wgTitle, $wgRequest;
$fname = 'wfSpecialRecentchangeslinked';
$days = $wgRequest->getInt('days');
$target = isset($par) ? $par : $wgRequest->getText('target');
$hideminor = $wgRequest->getBool('hideminor') ? 1 : 0;
$wgOut->setPagetitle(wfMsg('recentchangeslinked'));
$sk = $wgUser->getSkin();
if (is_null($target)) {
$wgOut->errorpage('notargettitle', 'notargettext');
return;
}
$nt = Title::newFromURL($target);
if (!$nt) {
$wgOut->errorpage('notargettitle', 'notargettext');
return;
}
$id = $nt->getArticleId();
$wgOut->setSubtitle(htmlspecialchars(wfMsg('rclsub', $nt->getPrefixedText())));
if (!$days) {
$days = $wgUser->getOption('rcdays');
if (!$days) {
$days = 7;
}
}
$days = (int) $days;
list($limit, $offset) = wfCheckLimits(100, 'rclimit');
$dbr =& wfGetDB(DB_SLAVE);
$cutoff = $dbr->timestamp(time() - $days * 86400);
$hideminor = $hideminor ? 1 : 0;
if ($hideminor) {
$mlink = $sk->makeKnownLink($wgContLang->specialPage('Recentchangeslinked'), WfMsg('show'), 'target=' . htmlspecialchars($nt->getPrefixedURL()) . "&days={$days}&limit={$limit}&hideminor=0");
} else {
$mlink = $sk->makeKnownLink($wgContLang->specialPage("Recentchangeslinked"), WfMsg("hide"), "target=" . htmlspecialchars($nt->getPrefixedURL()) . "&days={$days}&limit={$limit}&hideminor=1");
}
if ($hideminor) {
$cmq = 'AND rev_minor_edit=0';
} else {
$cmq = '';
}
extract($dbr->tableNames('categorylinks', 'pagelinks', 'revision', 'page'));
// If target is a Category, use categorylinks and invert from and to
if ($nt->getNamespace() == NS_CATEGORY) {
$catkey = $dbr->addQuotes($nt->getDBKey());
$sql = "SELECT page_id,page_namespace,page_title,rev_id,rev_user,rev_comment,\n rev_user_text,rev_timestamp,rev_minor_edit,\n page_is_new\n FROM {$categorylinks}, {$revision}, {$page}\n WHERE rev_timestamp > '{$cutoff}'\n {$cmq}\n AND rev_page=page_id\n AND cl_from=page_id\n AND cl_to={$catkey}\nGROUP BY page_id,page_namespace,page_title,\n rev_user,rev_comment,rev_user_text,rev_timestamp,rev_minor_edit,\n page_is_new\nORDER BY rev_timestamp DESC\n LIMIT {$limit}";
} else {
$sql = "SELECT page_id,page_namespace,page_title,\n rev_user,rev_comment,rev_user_text,rev_id,rev_timestamp,rev_minor_edit,\n page_is_new\n FROM {$pagelinks}, {$revision}, {$page}\n WHERE rev_timestamp > '{$cutoff}'\n {$cmq}\n AND rev_page=page_id\n AND pl_namespace=page_namespace\n AND pl_title=page_title\n AND pl_from={$id}\nGROUP BY page_id,page_namespace,page_title,\n rev_user,rev_comment,rev_user_text,rev_timestamp,rev_minor_edit,\n page_is_new\nORDER BY rev_timestamp DESC\n LIMIT {$limit}";
}
$res = $dbr->query($sql, $fname);
$wgOut->addHTML("< " . $sk->makeKnownLinkObj($nt, "", "redirect=no") . "<br />\n");
$note = wfMsg("rcnote", $limit, $days);
$wgOut->addHTML("<hr />\n{$note}\n<br />");
$note = rcDayLimitlinks($days, $limit, "Recentchangeslinked", "target=" . $nt->getPrefixedURL() . "&hideminor={$hideminor}", false, $mlink);
$wgOut->addHTML($note . "\n");
$list =& new ChangesList($sk);
$s = $list->beginRecentChangesList();
$count = $dbr->numRows($res);
$counter = 1;
while ($limit) {
if (0 == $count) {
break;
}
$obj = $dbr->fetchObject($res);
--$count;
$rc = RecentChange::newFromCurRow($obj);
$rc->counter = $counter++;
$s .= $list->recentChangesLine($rc);
--$limit;
}
$s .= $list->endRecentChangesList();
$dbr->freeResult($res);
$wgOut->addHTML($s);
}
示例3: wfSpecialWatchlist
//.........这里部分代码省略.........
$sql = 'select wl_namespace, wl_title from watchlist where wl_user=' . $wgUser->getID() . ' and wl_notificationtimestamp > \'0\'';
$res = $dbr->query($sql, $fname);
$sk = $wgUser->getSkin();
$changed = '';
$count = 0;
while ($obj = $dbr->fetchObject($res)) {
$t = Title::makeTitle($obj->wl_namespace, $obj->wl_title);
$historylink = $sk->makeKnownLinkObj($t, 'hist', wfArrayToCGI(array('action' => 'history')));
$articlelink = $sk->makeKnownLinkObj($t);
$changed .= "<li> ( {$historylink} ) . . {$articlelink}</li>\n";
$count += 1;
}
$dbr->freeResult($res);
$wgOut->addHTML("<h3>{$count} page(s)</h3>\n<ul>" . $changed . '</ul>');
return;
}
// WERELATE - remove join with page table
$sql = "SELECT\n\t rc_namespace AS page_namespace, rc_title AS page_title,\n\t rc_comment AS rev_comment, rc_cur_id AS page_id,\n\t rc_user AS rev_user, rc_user_text AS rev_user_text,\n\t rc_timestamp AS rev_timestamp, rc_minor AS rev_minor_edit,\n\t rc_this_oldid AS rev_id,\n\t rc_last_oldid, rc_id, rc_patrolled,\n\t rc_new AS page_is_new,wl_notificationtimestamp\n\t FROM {$watchlist},{$recentchanges}\n\t WHERE wl_user={$uid}\n\t AND wl_namespace=rc_namespace\n\t AND wl_title=rc_title\n\t AND rc_timestamp > '{$cutoff}'\n\t {$andHideOwn}\n\t {$andHideBots}\n\t {$nameSpaceClause}\n\t ORDER BY rc_timestamp DESC\n\t {$limitWatchlist}";
$res = $dbr->query($sql, $fname);
// WERELATE - moved up from below so we can calculate $numRows inside the loop
// $numRows = $dbr->numRows( $res );
$numRows = 0;
$list = ChangesList::newFromUser($wgUser);
$rcs = $list->beginRecentChangesList();
$counter = 1;
// WERELATE - added array of seen pagetitles
$seen = array();
while ($obj = $dbr->fetchObject($res)) {
$nsTitle = "{$obj->page_namespace}:{$obj->page_title}";
if (!$andLatest || !isset($seen[$nsTitle])) {
$seen[$nsTitle] = 1;
$numRows++;
# Make fake RC entry
$rc = RecentChange::newFromCurRow($obj, $obj->rc_last_oldid);
$rc->counter = $counter++;
if ($wgShowUpdatedMarker) {
$updated = $obj->wl_notificationtimestamp;
} else {
// Same visual appearance as MW 1.4
$updated = true;
}
if ($wgRCShowWatchingUsers && $wgUser->getOption('shownumberswatching')) {
$sql3 = "SELECT COUNT(*) AS n FROM {$watchlist} WHERE wl_title='" . wfStrencode($obj->page_title) . "' AND wl_namespace='{$obj->page_namespace}'";
$res3 = $dbr->query($sql3, DB_READ, $fname);
$x = $dbr->fetchObject($res3);
$rc->numberofWatchingusers = $x->n;
} else {
$rc->numberofWatchingusers = 0;
}
$rcs .= $list->recentChangesLine($rc, $updated);
}
}
$rcs .= $list->endRecentChangesList();
$dbr->freeResult($res);
/* Start bottom header */
// WERELATE - add link to changed view
// $wgOut->addHTML( "<hr />\n<p>" );
$wgOut->addHTML('<hr /><h2>Recently-changed pages</h2><ul><li><a href="' . $specialTitle->getFullUrl('changed=yes') . '">Show all pages changed since last visited</a></li></ul><br/><p>');
if ($days >= 1) {
$wgOut->addWikiText(wfMsg('rcnote', $wgLang->formatNum($numRows), $wgLang->formatNum($days), $wgLang->timeAndDate(wfTimestampNow(), true)) . '<br />', false);
} elseif ($days > 0) {
$wgOut->addWikiText(wfMsg('wlnote', $wgLang->formatNum($numRows), $wgLang->formatNum(round($days * 24))) . '<br />', false);
}
$wgOut->addHTML("\n" . wlCutoffLinks($days, 'Watchlist', $nondefaults) . "<br />\n");
# Spit out some control panel links
$thisTitle = Title::makeTitle(NS_SPECIAL, 'Watchlist');
示例4: revisionInfo
function revisionInfo($row)
{
global $wgUser;
$changes = ChangesList::newFromContext(RequestContext::getMain());
$out = $changes->beginRecentChangesList();
$rc = RecentChange::newFromCurRow($row);
$rc->counter = 0;
// ???
$out .= $changes->recentChangesLine($rc);
$out .= $changes->endRecentChangesList();
return $out;
}