本文整理汇总了PHP中LogPage::isLogType方法的典型用法代码示例。如果您正苦于以下问题:PHP LogPage::isLogType方法的具体用法?PHP LogPage::isLogType怎么用?PHP LogPage::isLogType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogPage
的用法示例。
在下文中一共展示了LogPage::isLogType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showHeader
/**
* Set page title and show header for this log type
* @param $type String
*/
public function showHeader($type)
{
if (LogPage::isLogType($type)) {
$this->out->setPageTitle(LogPage::logName($type));
$this->out->addHTML(LogPage::logHeader($type));
}
}
示例2: execute
public function execute($par)
{
global $wgLogRestrictions;
$this->setHeaders();
$this->outputHeader();
$opts = new FormOptions();
$opts->add('type', '');
$opts->add('user', '');
$opts->add('page', '');
$opts->add('pattern', false);
// $opts->add( 'year', null, FormOptions::INTNULL ); don't default to zero
$opts->add('year', '');
$opts->add('month', null, FormOptions::INTNULL);
$opts->add('tagfilter', '');
$opts->add('offset', '');
$opts->add('dir', '');
$opts->add('offender', '');
// Set values
$opts->fetchValuesFromRequest($this->getRequest());
if ($par !== null) {
$this->parseParams($opts, (string) $par);
}
# Don't let the user get stuck with a certain date
if ($opts->getValue('offset') || $opts->getValue('dir') == 'prev') {
$opts->setValue('year', '');
$opts->setValue('month', '');
}
// If the user doesn't have the right permission to view the specific
// log type, throw a PermissionsError
// If the log type is invalid, just show all public logs
$type = $opts->getValue('type');
if (!LogPage::isLogType($type)) {
$opts->setValue('type', '');
} elseif (isset($wgLogRestrictions[$type]) && !$this->getUser()->isAllowed($wgLogRestrictions[$type])) {
throw new PermissionsError($wgLogRestrictions[$type]);
}
# Handle type-specific inputs
$qc = array();
if ($opts->getValue('type') == 'suppress') {
$offender = User::newFromName($opts->getValue('offender'), false);
if ($offender && $offender->getId() > 0) {
$qc = array('ls_field' => 'target_author_id', 'ls_value' => $offender->getId());
} elseif ($offender && IP::isIPAddress($offender->getName())) {
$qc = array('ls_field' => 'target_author_ip', 'ls_value' => $offender->getName());
}
}
# Some log types are only for a 'User:' title but we might have been given
# only the username instead of the full title 'User:username'. This part try
# to lookup for a user by that name and eventually fix user input. See bug 1697.
wfRunHooks('GetLogTypesOnUser', array(&$this->typeOnUser));
if (in_array($opts->getValue('type'), $this->typeOnUser)) {
# ok we have a type of log which expect a user title.
$target = Title::newFromText($opts->getValue('page'));
if ($target && $target->getNamespace() === NS_MAIN) {
# User forgot to add 'User:', we are adding it for him
$opts->setValue('page', Title::makeTitleSafe(NS_USER, $opts->getValue('page')));
}
}
$this->show($opts, $qc);
}
示例3: showHeader
/**
* Set page title and show header for this log type
* @param $type Array
*/
public function showHeader($type)
{
// If only one log type is used, then show a special message...
$headerType = count($type) == 1 ? $type[0] : '';
if (LogPage::isLogType($headerType)) {
$this->out->setPageTitle(LogPage::logName($headerType));
$this->out->addHTML(LogPage::logHeader($headerType));
} else {
$this->out->addHTML(wfMsgExt('alllogstext', array('parseinline')));
}
}
示例4: showHeader
/**
* Set page title and show header for this log type
* @param $type Array
* @deprecated in 1.19
*/
public function showHeader( $type ) {
wfDeprecated( __METHOD__, '1.19' );
// If only one log type is used, then show a special message...
$headerType = count( $type ) == 1 ? $type[0] : '';
$out = $this->getOutput();
if ( LogPage::isLogType( $headerType ) ) {
$page = new LogPage( $headerType );
$out->setPageTitle( $page->getName()->text() );
$out->addHTML( $page->getDescription()->parseAsBlock() );
} else {
$out->addHTML( $this->msg( 'alllogstext' )->parse() );
}
}
示例5: showHeader
/**
* @param OutputPage &$out where to send output
* @private
*/
function showHeader(&$out)
{
$type = $this->reader->queryType();
if (LogPage::isLogType($type)) {
$out->setPageTitle(LogPage::logName($type));
$out->addWikiText(LogPage::logHeader($type));
}
}
示例6: getDisallowedErrorMessage
/**
* @todo Move this to AbstractBlock and use for summary/header/etc.
* @param AbstractRevision $revision
* @return Message
*/
protected function getDisallowedErrorMessage(AbstractRevision $revision)
{
if (in_array($this->action, array('moderate-topic', 'moderate-post'))) {
/*
* When failing to moderate an already moderated action (like
* undo), show the more general "you have insufficient
* permissions for this action" message, rather than the
* specialized "this topic is <hidden|deleted|suppressed>" msg.
*/
return $this->context->msg('flow-error-not-allowed');
}
$state = $revision->getModerationState();
// display simple message
// i18n messages:
// flow-error-not-allowed-hide,
// flow-error-not-allowed-reply-to-hide-topic
// flow-error-not-allowed-delete
// flow-error-not-allowed-reply-to-delete-topic
// flow-error-not-allowed-suppress
// flow-error-not-allowed-reply-to-suppress-topic
if ($revision instanceof PostRevision) {
$type = $revision->isTopicTitle() ? 'topic' : 'post';
} else {
$type = $revision->getRevisionType();
}
// Show a snippet of the relevant log entry if available.
if (\LogPage::isLogType($state)) {
// check if user has sufficient permissions to see log
$logPage = new \LogPage($state);
if ($this->context->getUser()->isAllowed($logPage->getRestriction())) {
// LogEventsList::showLogExtract will write to OutputPage, but we
// actually just want that text, to write it ourselves wherever we want,
// so let's create an OutputPage object to then get the content from.
$rc = new \RequestContext();
$output = $rc->getOutput();
// get log extract
$entries = \LogEventsList::showLogExtract($output, array($state), $this->workflow->getArticleTitle()->getPrefixedText(), '', array('lim' => 10, 'showIfEmpty' => false, 'msgKey' => array(array("flow-error-not-allowed-{$this->action}-to-{$state}-{$type}", "flow-error-not-allowed-{$state}-extract"))));
// check if there were any log extracts
if ($entries) {
$message = new \RawMessage('$1');
return $message->rawParams($output->getHTML());
}
}
}
return $this->context->msg(array("flow-error-not-allowed-{$this->action}-to-{$state}-{$type}", "flow-error-not-allowed-{$state}", "flow-error-not-allowed"));
}