當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。