本文整理汇总了PHP中Block::getBlocker方法的典型用法代码示例。如果您正苦于以下问题:PHP Block::getBlocker方法的具体用法?PHP Block::getBlocker怎么用?PHP Block::getBlocker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Block
的用法示例。
在下文中一共展示了Block::getBlocker方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: userBlockedMessage
/**
* Output a message that informs the user that they cannot create an account because
* there is a block on them or their IP which prevents account creation. Note that
* User::isBlockedFromCreateAccount(), which gets this block, ignores the 'hardblock'
* setting on blocks (bug 13611).
* @param $block Block the block causing this error
*/
function userBlockedMessage(Block $block)
{
global $wgOut;
# Let's be nice about this, it's likely that this feature will be used
# for blocking large numbers of innocent people, e.g. range blocks on
# schools. Don't blame it on the user. There's a small chance that it
# really is the user's fault, i.e. the username is blocked and they
# haven't bothered to log out before trying to create an account to
# evade it, but we'll leave that to their guilty conscience to figure
# out.
$wgOut->setPageTitle(wfMsg('cantcreateaccounttitle'));
$block_reason = $block->mReason;
if (strval($block_reason) === '') {
$block_reason = wfMsg('blockednoreason');
}
$wgOut->addWikiMsg('cantcreateaccount-text', $block->getTarget(), $block_reason, $block->getBlocker()->getName());
$wgOut->returnToMain(false);
}
示例2: __construct
public function __construct(Block $block)
{
global $wgLang, $wgRequest;
$blocker = $block->getBlocker();
if ($blocker instanceof User) {
// local user
$blockerUserpage = $block->getBlocker()->getUserPage();
$link = "[[{$blockerUserpage->getPrefixedText()}|{$blockerUserpage->getText()}]]";
} else {
// foreign user
$link = $blocker;
}
$reason = $block->mReason;
if ($reason == '') {
$reason = wfMsg('blockednoreason');
}
/* $ip returns who *is* being blocked, $intended contains who was meant to be blocked.
* This could be a username, an IP range, or a single IP. */
$intended = $block->getTarget();
parent::__construct('blockedtitle', $block->mAuto ? 'autoblockedtext' : 'blockedtext', array($link, $reason, $wgRequest->getIP(), $block->getByName(), $block->getId(), $wgLang->formatExpiry($block->mExpiry), $intended, $wgLang->timeanddate(wfTimestamp(TS_MW, $block->mTimestamp), true)));
}
示例3: eventlogBlockIp
/**
* @static
* @param Block $block instance of Block class includes/Block.php
* @param User $user instance of User class includes/User.php
* @return bool true 'cause it's a hook
*/
public static function eventlogBlockIp($block, $user)
{
self::log("block", "block", $user->getID(), $user->getName(), $block->getBlocker(), $block->getTarget(), $block->mReason);
return true;
}