当前位置: 首页>>代码示例>>PHP>>正文


PHP Block::getType方法代码示例

本文整理汇总了PHP中Block::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP Block::getType方法的具体用法?PHP Block::getType怎么用?PHP Block::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Block的用法示例。


在下文中一共展示了Block::getType方法的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
  * @throws ErrorPageError
  */
 function userBlockedMessage(Block $block)
 {
     # 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.
     $errorParams = array($block->getTarget(), $block->mReason ? $block->mReason : $this->msg('blockednoreason')->text(), $block->getByName());
     if ($block->getType() === Block::TYPE_RANGE) {
         $errorMessage = 'cantcreateaccount-range-text';
         $errorParams[] = $this->getRequest()->getIP();
     } else {
         $errorMessage = 'cantcreateaccount-text';
     }
     throw new ErrorPageError('cantcreateaccounttitle', $errorMessage, $errorParams);
 }
开发者ID:natebrunette,项目名称:sphericalcow,代码行数:26,代码来源:SpecialUserlogin.php

示例2: dieBlocked

 /**
  * Throw a UsageException, which will (if uncaught) call the main module's
  * error handler and die with an error message including block info.
  *
  * @since 1.27
  * @param Block $block The block used to generate the UsageException
  * @throws UsageException always
  */
 public function dieBlocked(Block $block)
 {
     // Die using the appropriate message depending on block type
     if ($block->getType() == Block::TYPE_AUTO) {
         $this->dieUsage('Your IP address has been blocked automatically, because it was used by a blocked user', 'autoblocked', 0, array('blockinfo' => ApiQueryUserInfo::getBlockInfo($block)));
     } else {
         $this->dieUsage('You have been blocked from editing', 'blocked', 0, array('blockinfo' => ApiQueryUserInfo::getBlockInfo($block)));
     }
 }
开发者ID:xiebinyi,项目名称:mediawiki,代码行数:17,代码来源:ApiBase.php

示例3: Blank

 function test_simple_components()
 {
     $comp = new Blank(3);
     $this->assertIdentical($comp->getType(), BLANK);
     $comp = new Block("hoho", 3);
     $this->assertIdentical($comp->getType(), BLOCK);
     $comp = new Heading("hoho", 3);
     $this->assertIdentical($comp->getType(), HEADING);
     $comp = new Footer("hoho", 3);
     $this->assertIdentical($comp->getType(), FOOTER);
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:11,代码来源:ComponentsTestCase.class.php


注:本文中的Block::getType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。