本文整理汇总了PHP中LogEventsList::beginLogEventsList方法的典型用法代码示例。如果您正苦于以下问题:PHP LogEventsList::beginLogEventsList方法的具体用法?PHP LogEventsList::beginLogEventsList怎么用?PHP LogEventsList::beginLogEventsList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogEventsList
的用法示例。
在下文中一共展示了LogEventsList::beginLogEventsList方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wfSpecialLog
/**
* constructor
*/
function wfSpecialLog($par = '')
{
global $wgRequest, $wgOut, $wgUser, $wgLogTypes;
# Get parameters
$parms = explode('/', $par = $par !== null ? $par : '');
$symsForAll = array('*', 'all');
if ($parms[0] != '' && (in_array($par, $wgLogTypes) || in_array($par, $symsForAll))) {
$type = $par;
$user = $wgRequest->getText('user');
} else {
if (count($parms) == 2) {
$type = $parms[0];
$user = $parms[1];
} else {
$type = $wgRequest->getVal('type');
$user = $par != '' ? $par : $wgRequest->getText('user');
}
}
$title = $wgRequest->getText('page');
$pattern = $wgRequest->getBool('pattern');
$y = $wgRequest->getIntOrNull('year');
$m = $wgRequest->getIntOrNull('month');
$tagFilter = $wgRequest->getVal('tagfilter');
# Don't let the user get stuck with a certain date
$skip = $wgRequest->getText('offset') || $wgRequest->getText('dir') == 'prev';
if ($skip) {
$y = '';
$m = '';
}
# Handle type-specific inputs
$qc = array();
if ($type == 'suppress') {
$offender = User::newFromName($wgRequest->getVal('offender'), false);
if ($offender && $offender->getId() > 0) {
$qc = array('ls_field' => 'target_author_id', 'ls_value' => $offender->getId());
} else {
if ($offender && IP::isIPAddress($offender->getName())) {
$qc = array('ls_field' => 'target_author_ip', 'ls_value' => $offender->getName());
}
}
}
# Create a LogPager item to get the results and a LogEventsList item to format them...
$loglist = new LogEventsList($wgUser->getSkin(), $wgOut, 0);
$pager = new LogPager($loglist, $type, $user, $title, $pattern, $qc, $y, $m, $tagFilter);
# Set title and add header
$loglist->showHeader($pager->getType());
# Show form options
$loglist->showOptions($pager->getType(), $pager->getUser(), $pager->getPage(), $pager->getPattern(), $pager->getYear(), $pager->getMonth(), $pager->getFilterParams(), $tagFilter);
# Insert list
$logBody = $pager->getBody();
if ($logBody) {
$wgOut->addHTML($pager->getNavigationBar() . $loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList() . $pager->getNavigationBar());
} else {
$wgOut->addWikiMsg('logempty');
}
}
示例2: execute
public function execute($par)
{
global $wgFlaggedRevsOversightAge;
$out = $this->getOutput();
$request = $this->getRequest();
$this->setHeaders();
$this->namespace = $request->getInt('namespace');
$this->level = $request->getIntOrNull('level');
$this->status = $request->getIntOrNull('status');
$this->automatic = $request->getIntOrNull('automatic');
$this->user = $request->getVal('user');
# Check if the user exists
$usertitle = Title::makeTitleSafe(NS_USER, $this->user);
$u = $usertitle ? User::idFromName($this->user) : false;
# Are the dropdown params given even valid?
$actions = $this->getActions();
if (empty($actions)) {
$out->addWikiMsg('qualityoversight-list', 0);
$out->addWikiMsg('logempty');
return;
}
# Get extra query conds
$conds = array('log_namespace' => $this->namespace, 'log_action' => $actions);
# Get cutoff time (mainly for performance)
if (!$u) {
$dbr = wfGetDB(DB_SLAVE);
$cutoff_unixtime = time() - $wgFlaggedRevsOversightAge;
$cutoff = $dbr->addQuotes($dbr->timestamp($cutoff_unixtime));
$conds[] = "log_timestamp >= {$cutoff}";
}
# Create a LogPager item to get the results and a LogEventsList item to format them...
$loglist = new LogEventsList($this->getContext()->getSkin(), $out, 0);
$pager = new LogPager($loglist, 'review', $this->user, '', '', $conds);
# Explanatory text
$out->addWikiMsg('qualityoversight-list', $this->getLanguage()->formatNum($pager->getNumRows()));
# Show form options
$this->showForm();
# Insert list
$logBody = $pager->getBody();
if ($logBody) {
$out->addHTML($pager->getNavigationBar() . $loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList() . $pager->getNavigationBar());
} else {
$out->addWikiMsg('logempty');
}
}
示例3: show
private function show(FormOptions $opts, array $extraConds)
{
global $wgOut;
# Create a LogPager item to get the results and a LogEventsList item to format them...
$loglist = new LogEventsList($this->getSkin(), $wgOut, 0);
$pager = new LogPager($loglist, $opts->getValue('type'), $opts->getValue('user'), $opts->getValue('page'), $opts->getValue('pattern'), $extraConds, $opts->getValue('year'), $opts->getValue('month'), $opts->getValue('tagfilter'));
# Set title and add header
$loglist->showHeader($pager->getType());
# Set relevant user
if ($pager->getUser()) {
$this->getSkin()->setRelevantUser(User::newFromName($pager->getUser()));
}
# Show form options
$loglist->showOptions($pager->getType(), $pager->getUser(), $pager->getPage(), $pager->getPattern(), $pager->getYear(), $pager->getMonth(), $pager->getFilterParams(), $opts->getValue('tagfilter'));
# Insert list
$logBody = $pager->getBody();
if ($logBody) {
$wgOut->addHTML($pager->getNavigationBar() . $loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList() . $pager->getNavigationBar());
} else {
$wgOut->addWikiMsg('logempty');
}
}
示例4: showLogExtract
/**
* Show log extract. Either with text and a box (set $msgKey) or without (don't set $msgKey)
*
* @param OutputPage|string $out By-reference
* @param string|array $types Log types to show
* @param string|Title $page The page title to show log entries for
* @param string $user The user who made the log entries
* @param array $param Associative Array with the following additional options:
* - lim Integer Limit of items to show, default is 50
* - conds Array Extra conditions for the query (e.g. "log_action != 'revision'")
* - showIfEmpty boolean Set to false if you don't want any output in case the loglist is empty
* if set to true (default), "No matching items in log" is displayed if loglist is empty
* - msgKey Array If you want a nice box with a message, set this to the key of the message.
* First element is the message key, additional optional elements are parameters for the key
* that are processed with wfMessage
* - offset Set to overwrite offset parameter in WebRequest
* set to '' to unset offset
* - wrap String Wrap the message in html (usually something like "<div ...>$1</div>").
* - flags Integer display flags (NO_ACTION_LINK,NO_EXTRA_USER_LINKS)
* - useRequestParams boolean Set true to use Pager-related parameters in the WebRequest
* - useMaster boolean Use master DB
* @return int Number of total log items (not limited by $lim)
*/
public static function showLogExtract(&$out, $types = array(), $page = '', $user = '', $param = array())
{
$defaultParameters = array('lim' => 25, 'conds' => array(), 'showIfEmpty' => true, 'msgKey' => array(''), 'wrap' => "\$1", 'flags' => 0, 'useRequestParams' => false, 'useMaster' => false);
# The + operator appends elements of remaining keys from the right
# handed array to the left handed, whereas duplicated keys are NOT overwritten.
$param += $defaultParameters;
# Convert $param array to individual variables
$lim = $param['lim'];
$conds = $param['conds'];
$showIfEmpty = $param['showIfEmpty'];
$msgKey = $param['msgKey'];
$wrap = $param['wrap'];
$flags = $param['flags'];
$useRequestParams = $param['useRequestParams'];
if (!is_array($msgKey)) {
$msgKey = array($msgKey);
}
if ($out instanceof OutputPage) {
$context = $out->getContext();
} else {
$context = RequestContext::getMain();
}
# Insert list of top 50 (or top $lim) items
$loglist = new LogEventsList($context, null, $flags);
$pager = new LogPager($loglist, $types, $user, $page, '', $conds);
if (!$useRequestParams) {
# Reset vars that may have been taken from the request
$pager->mLimit = 50;
$pager->mDefaultLimit = 50;
$pager->mOffset = "";
$pager->mIsBackwards = false;
}
if ($param['useMaster']) {
$pager->mDb = wfGetDB(DB_MASTER);
}
if (isset($param['offset'])) {
# Tell pager to ignore WebRequest offset
$pager->setOffset($param['offset']);
}
if ($lim > 0) {
$pager->mLimit = $lim;
}
// Fetch the log rows and build the HTML if needed
$logBody = $pager->getBody();
$numRows = $pager->getNumRows();
$s = '';
if ($logBody) {
if ($msgKey[0]) {
$dir = $context->getLanguage()->getDir();
$lang = $context->getLanguage()->getHtmlCode();
$s = Xml::openElement('div', array('class' => "mw-warning-with-logexcerpt mw-content-{$dir}", 'dir' => $dir, 'lang' => $lang));
if (count($msgKey) == 1) {
$s .= $context->msg($msgKey[0])->parseAsBlock();
} else {
// Process additional arguments
$args = $msgKey;
array_shift($args);
$s .= $context->msg($msgKey[0], $args)->parseAsBlock();
}
}
$s .= $loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList();
} elseif ($showIfEmpty) {
$s = Html::rawElement('div', array('class' => 'mw-warning-logempty'), $context->msg('logempty')->parse());
}
if ($numRows > $pager->mLimit) {
# Show "Full log" link
$urlParam = array();
if ($page instanceof Title) {
$urlParam['page'] = $page->getPrefixedDBkey();
} elseif ($page != '') {
$urlParam['page'] = $page;
}
if ($user != '') {
$urlParam['user'] = $user;
}
if (!is_array($types)) {
# Make it an array, if it isn't
//.........这里部分代码省略.........
示例5: showLogExtract
/**
* Show log extract. Either with text and a box (set $msgKey) or without (don't set $msgKey)
*
* @param $out OutputPage|String-by-reference
* @param $types String or Array
* @param $page String The page title to show log entries for
* @param $user String The user who made the log entries
* @param $param Associative Array with the following additional options:
* - lim Integer Limit of items to show, default is 50
* - conds Array Extra conditions for the query (e.g. "log_action != 'revision'")
* - showIfEmpty boolean Set to false if you don't want any output in case the loglist is empty
* if set to true (default), "No matching items in log" is displayed if loglist is empty
* - msgKey Array If you want a nice box with a message, set this to the key of the message.
* First element is the message key, additional optional elements are parameters for the key
* that are processed with wgMsgExt and option 'parse'
* - offset Set to overwrite offset parameter in $wgRequest
* set to '' to unset offset
* - wrap String Wrap the message in html (usually something like "<div ...>$1</div>").
* - flags Integer display flags (NO_ACTION_LINK,NO_EXTRA_USER_LINKS)
* @return Integer Number of total log items (not limited by $lim)
*/
public static function showLogExtract(&$out, $types = array(), $page = '', $user = '', $param = array())
{
global $wgUser, $wgOut;
$defaultParameters = array('lim' => 25, 'conds' => array(), 'showIfEmpty' => true, 'msgKey' => array(''), 'wrap' => "\$1", 'flags' => 0);
# The + operator appends elements of remaining keys from the right
# handed array to the left handed, whereas duplicated keys are NOT overwritten.
$param += $defaultParameters;
# Convert $param array to individual variables
$lim = $param['lim'];
$conds = $param['conds'];
$showIfEmpty = $param['showIfEmpty'];
$msgKey = $param['msgKey'];
$wrap = $param['wrap'];
$flags = $param['flags'];
if (!is_array($msgKey)) {
$msgKey = array($msgKey);
}
# Insert list of top 50 (or top $lim) items
$loglist = new LogEventsList($wgUser->getSkin(), $wgOut, $flags);
$pager = new LogPager($loglist, $types, $user, $page, '', $conds);
if (isset($param['offset'])) {
# Tell pager to ignore $wgRequest offset
$pager->setOffset($param['offset']);
}
if ($lim > 0) {
$pager->mLimit = $lim;
}
$logBody = $pager->getBody();
$s = '';
if ($logBody) {
if ($msgKey[0]) {
$s = '<div class="mw-warning-with-logexcerpt">';
if (count($msgKey) == 1) {
$s .= wfMsgExt($msgKey[0], array('parse'));
} else {
// Process additional arguments
$args = $msgKey;
array_shift($args);
$s .= wfMsgExt($msgKey[0], array('parse'), $args);
}
}
$s .= $loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList();
} else {
if ($showIfEmpty) {
$s = Html::rawElement('div', array('class' => 'mw-warning-logempty'), wfMsgExt('logempty', array('parseinline')));
}
}
if ($pager->getNumRows() > $pager->mLimit) {
# Show "Full log" link
$urlParam = array();
if ($page != '') {
$urlParam['page'] = $page;
}
if ($user != '') {
$urlParam['user'] = $user;
}
if (!is_array($types)) {
# Make it an array, if it isn't
$types = array($types);
}
# If there is exactly one log type, we can link to Special:Log?type=foo
if (count($types) == 1) {
$urlParam['type'] = $types[0];
}
$s .= Linker::link(SpecialPage::getTitleFor('Log'), wfMsgHtml('log-fulllog'), array(), $urlParam);
}
if ($logBody && $msgKey[0]) {
$s .= '</div>';
}
if ($wrap != '') {
// Wrap message in html
$s = str_replace('$1', $s, $wrap);
}
// $out can be either an OutputPage object or a String-by-reference
if ($out instanceof OutputPage) {
$out->addHTML($s);
} else {
$out = $s;
}
//.........这里部分代码省略.........
示例6: showDeletionLog
/**
* Show the set of previous deletions for the page being added.
* This function is copied almost exactly from
* EditPage::showDeletionLog() - unfortunately, neither that function
* nor Article::showDeletionLog() can be called from here, since
* they're both protected.
*/
function showDeletionLog( $out ) {
// if MW doesn't have LogEventsList defined, exit immediately
if ( ! class_exists( 'LogEventsList' ) )
return false;
global $wgUser;
$loglist = new LogEventsList( $wgUser->getSkin(), $out );
$pager = new LogPager( $loglist, 'delete', false, $this->mPageTitle->getPrefixedText() );
$count = $pager->getNumRows();
if ( $count > 0 ) {
$pager->mLimit = 10;
$out->addHTML( '<div class="mw-warning-with-logexcerpt">' );
$out->addWikiMsg( 'moveddeleted-notice' );
$out->addHTML(
$loglist->beginLogEventsList() .
$pager->getBody() .
$loglist->endLogEventsList()
);
if ( $count > 10 ) {
$out->addHTML( $wgUser->getSkin()->link(
SpecialPage::getTitleFor( 'Log' ),
wfMsgHtml( 'deletelog-fulllog' ),
array(),
array(
'type' => 'delete',
'page' => $this->mPageTitle->getPrefixedText() ) ) );
}
$out->addHTML( '</div>' );
return true;
}
return false;
}
示例7: show
private function show(FormOptions $opts, array $extraConds)
{
# Create a LogPager item to get the results and a LogEventsList item to format them...
$loglist = new LogEventsList($this->getContext(), null, LogEventsList::USE_REVDEL_CHECKBOXES);
$pager = new LogPager($loglist, $opts->getValue('type'), $opts->getValue('user'), $opts->getValue('page'), $opts->getValue('pattern'), $extraConds, $opts->getValue('year'), $opts->getValue('month'), $opts->getValue('tagfilter'));
$this->addHeader($opts->getValue('type'));
# Set relevant user
if ($pager->getPerformer()) {
$this->getSkin()->setRelevantUser(User::newFromName($pager->getPerformer()));
}
# Show form options
$loglist->showOptions($pager->getType(), $opts->getValue('user'), $pager->getPage(), $pager->getPattern(), $pager->getYear(), $pager->getMonth(), $pager->getFilterParams(), $opts->getValue('tagfilter'));
# Insert list
$logBody = $pager->getBody();
if ($logBody) {
$this->getOutput()->addHTML($pager->getNavigationBar() . $this->getRevisionButton($loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList()) . $pager->getNavigationBar());
} else {
$this->getOutput()->addWikiMsg('logempty');
}
}
示例8: showDeletionLog
/**
* If there are rows in the deletion log for this page, show them,
* along with a nice little note for the user
*
* @param OutputPage $out
*/
protected function showDeletionLog($out)
{
global $wgUser;
$loglist = new LogEventsList($wgUser->getSkin(), $out);
$pager = new LogPager($loglist, 'delete', false, $this->mTitle->getPrefixedText());
$count = $pager->getNumRows();
if ($count > 0) {
$pager->mLimit = 10;
$out->addHTML('<div class="mw-warning-with-logexcerpt">');
$out->addWikiMsg('recreate-deleted-warn');
$out->addHTML($loglist->beginLogEventsList() . $pager->getBody() . $loglist->endLogEventsList());
if ($count > 10) {
$out->addHTML($wgUser->getSkin()->link(SpecialPage::getTitleFor('Log'), wfMsgHtml('deletelog-fulllog'), array(), array('type' => 'delete', 'page' => $this->mTitle->getPrefixedText())));
}
$out->addHTML('</div>');
return true;
}
return false;
}
示例9: showLogExtract
/**
* Quick function to show a short log extract
* @param $out OutputPage
* @param $type String
* @param $page String
* @param $user String
* @param $lim Integer
* @param $conds Array
*/
public static function showLogExtract($out, $type = '', $page = '', $user = '', $lim = 0, $conds = array())
{
global $wgUser;
# Insert list of top 50 or so items
$loglist = new LogEventsList($wgUser->getSkin(), $out, 0);
$pager = new LogPager($loglist, $type, $user, $page, '', $conds);
if ($lim > 0) {
$pager->mLimit = $lim;
}
$logBody = $pager->getBody();
if ($logBody) {
$out->addHTML($loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList());
} else {
$out->addWikiMsg('logempty');
}
return $pager->getNumRows();
}
示例10: showDeletionLog
/**
* If there are rows in the deletion log for this file, show them,
* along with a nice little note for the user
*
* @param OutputPage $out
* @param string filename
*/
private function showDeletionLog($out, $filename)
{
global $wgUser;
$loglist = new LogEventsList($wgUser->getSkin(), $out);
$pager = new LogPager($loglist, 'delete', false, $filename);
if ($pager->getNumRows() > 0) {
$out->addHTML('<div class="mw-warning-with-logexcerpt">');
$out->addWikiMsg('upload-wasdeleted');
$out->addHTML($loglist->beginLogEventsList() . $pager->getBody() . $loglist->endLogEventsList());
$out->addHTML('</div>');
}
}
示例11: show
private function show(FormOptions $opts, array $extraConds)
{
# Create a LogPager item to get the results and a LogEventsList item to format them...
$loglist = new LogEventsList($this->getContext(), null, LogEventsList::USE_REVDEL_CHECKBOXES);
$pager = new LogPager($loglist, $opts->getValue('type'), $opts->getValue('user'), $opts->getValue('page'), $opts->getValue('pattern'), $extraConds, $opts->getValue('year'), $opts->getValue('month'), $opts->getValue('tagfilter'));
$this->addHeader($opts->getValue('type'));
# Set relevant user
if ($pager->getPerformer()) {
$this->getSkin()->setRelevantUser(User::newFromName($pager->getPerformer()));
}
# Show form options
$loglist->showOptions($pager->getType(), $opts->getValue('user'), $pager->getPage(), $pager->getPattern(), $pager->getYear(), $pager->getMonth(), $pager->getFilterParams(), $opts->getValue('tagfilter'));
# Reuben, upgrade 1.23: apply a special hack where we insert FORCE INDEX (times)
# into the sql query, because Mysql chooses the wrong index and the Database
# class has a bug where it generates sql with syntax errors.
if (!$pager->getType() && !$opts->getValue('user') && !$pager->getPage()) {
$pager->setIndexHack();
}
# Insert list
$logBody = $pager->getBody();
if ($logBody) {
$this->getOutput()->addHTML($pager->getNavigationBar() . $this->getRevisionButton($loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList()) . $pager->getNavigationBar());
} else {
$this->getOutput()->addWikiMsg('logempty');
}
}
示例12: showDeletionLog
/**
* Show the set of previous deletions for the page being edited.
*/
function showDeletionLog($out)
{
// if MW doesn't have LogEventsList defined, exit immediately
if (!class_exists('LogEventsList')) {
return false;
}
// MW 1.18+ ?
if (method_exists('LogEventsList', 'showLogExtract')) {
LogEventsList::showLogExtract($out, 'delete', $this->mPageTitle->getPrefixedText(), '', array('lim' => 10, 'conds' => array("log_action != 'revision'"), 'showIfEmpty' => false, 'msgKey' => array('moveddeleted-notice')));
return true;
}
// Old code, that can be removed once compatibility for
// MW 1.17 goes away (or maybe it can be removed already).
// This code was copied almost exactly from the method
// EditPage::showDeletionLog(), which no longer exists.
global $wgUser;
$loglist = new LogEventsList($wgUser->getSkin(), $out);
$pager = new LogPager($loglist, 'delete', false, $this->mPageTitle->getPrefixedText());
$count = $pager->getNumRows();
if ($count > 0) {
$pager->mLimit = 10;
$out->addHTML('<div class="mw-warning-with-logexcerpt">');
$out->addWikiMsg('moveddeleted-notice');
$out->addHTML($loglist->beginLogEventsList() . $pager->getBody() . $loglist->endLogEventsList());
if ($count > 10) {
$out->addHTML($wgUser->getSkin()->link(SpecialPage::getTitleFor('Log'), wfMessage('deletelog-fulllog')->escaped(), array(), array('type' => 'delete', 'page' => $this->mPageTitle->getPrefixedText())));
}
$out->addHTML('</div>');
return true;
}
return false;
}