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


PHP Block::getId方法代码示例

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


在下文中一共展示了Block::getId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addDBData

 function addDBData()
 {
     $user = User::newFromName('UTBlockee');
     if ($user->getID() == 0) {
         $user->addToDatabase();
         $user->setPassword('UTBlockeePassword');
         $user->saveSettings();
     }
     // Delete the last round's block if it's still there
     $oldBlock = Block::newFromTarget('UTBlockee');
     if ($oldBlock) {
         // An old block will prevent our new one from saving.
         $oldBlock->delete();
     }
     $this->block = new Block('UTBlockee', $user->getID(), 0, 'Parce que', 0, false, time() + 100500);
     $this->madeAt = wfTimestamp(TS_MW);
     $this->block->insert();
     // save up ID for use in assertion. Since ID is an autoincrement,
     // its value might change depending on the order the tests are run.
     // ApiBlockTest insert its own blocks!
     $newBlockId = $this->block->getId();
     if ($newBlockId) {
         $this->blockId = $newBlockId;
     } else {
         throw new MWException("Failed to insert block for BlockTest; old leftover block remaining?");
     }
     $this->addXffBlocks();
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:28,代码来源:BlockTest.php

示例2: getBlockInfo

 /**
  * Get basic info about a given block
  * @param Block $block
  * @return array Array containing several keys:
  *  - blockid - ID of the block
  *  - blockedby - username of the blocker
  *  - blockedbyid - user ID of the blocker
  *  - blockreason - reason provided for the block
  *  - blockedtimestamp - timestamp for when the block was placed/modified
  *  - blockexpiry - expiry time of the block
  */
 public static function getBlockInfo(Block $block)
 {
     global $wgContLang;
     $vals = array();
     $vals['blockid'] = $block->getId();
     $vals['blockedby'] = $block->getByName();
     $vals['blockedbyid'] = $block->getBy();
     $vals['blockreason'] = $block->mReason;
     $vals['blockedtimestamp'] = wfTimestamp(TS_ISO_8601, $block->mTimestamp);
     $vals['blockexpiry'] = $wgContLang->formatExpiry($block->getExpiry(), TS_ISO_8601, 'infinite');
     return $vals;
 }
开发者ID:D66Ha,项目名称:mediawiki,代码行数:23,代码来源:ApiQueryUserInfo.php

示例3: __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)));
 }
开发者ID:yusufchang,项目名称:app,代码行数:21,代码来源:Exception.php

示例4: getBlockId

 /**
  * If user is blocked, return the ID for the block
  * @return Int Block ID
  */
 public function getBlockId()
 {
     $this->getBlockedStatus();
     return $this->mBlock ? $this->mBlock->getId() : false;
 }
开发者ID:slackfaith,项目名称:deadbrain_site,代码行数:9,代码来源:User.php

示例5: getAllAsObject

 public function getAllAsObject($restriction = '')
 {
     $sql = "SELECT *\n\t\t\t\tFROM block\n\t\t\t\tWHERE 1=1";
     $sql .= $restriction . ";";
     try {
         $result = mysql_query($sql);
         if (!$result) {
             throw new MysqlException();
         }
         $blocks = array();
         while ($row = mysql_fetch_assoc($result)) {
             $b = new Block();
             $b->setId($row['block_id']);
             $b->setVon($row['von']);
             $b->setBis($row['bis']);
             $blocks[$b->getId()] = $b;
         }
     } catch (MysqlException $e) {
         Html::showAll($e);
     }
     return $blocks;
 }
开发者ID:runkelstrunkel,项目名称:Klassenbuch-Online,代码行数:22,代码来源:class.block.php


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