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


PHP Block::initFromRow方法代码示例

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


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

示例1: newFromRow

 /**
  * Create a new Block object from a database row
  * @param stdClass $row Row from the ipblocks table
  * @return Block
  */
 public static function newFromRow($row)
 {
     $block = new Block();
     $block->initFromRow($row);
     return $block;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:11,代码来源:Block.php

示例2: enumBlocks

 function enumBlocks($callback, $tag, $flags = 0)
 {
     global $wgAntiLockFlags;
     $block = new Block();
     if ($flags & Block::EB_FOR_UPDATE) {
         $db = wfGetDB(DB_MASTER);
         if ($wgAntiLockFlags & ALF_NO_BLOCK_LOCK) {
             $options = '';
         } else {
             $options = 'FOR UPDATE';
         }
         $block->forUpdate(true);
     } else {
         $db = wfGetDB(DB_SLAVE);
         $options = '';
     }
     if ($flags & Block::EB_RANGE_ONLY) {
         $cond = " AND ipb_range_start <> ''";
     } else {
         $cond = '';
     }
     $now = wfTimestampNow();
     list($ipblocks, $user) = $db->tableNamesN('ipblocks', 'user');
     $sql = "SELECT {$ipblocks}.*,user_name FROM {$ipblocks},{$user} " . "WHERE user_id=ipb_by {$cond} ORDER BY ipb_timestamp DESC {$options}";
     $res = $db->query($sql, 'Block::enumBlocks');
     $num_rows = $db->numRows($res);
     while ($row = $db->fetchObject($res)) {
         $block->initFromRow($row);
         if ($flags & Block::EB_RANGE_ONLY && $block->mRangeStart == '') {
             continue;
         }
         if (!($flags & Block::EB_KEEP_EXPIRED)) {
             if ($block->mExpiry && $now > $block->mExpiry) {
                 $block->delete();
             } else {
                 call_user_func($callback, $block, $tag);
             }
         } else {
             call_user_func($callback, $block, $tag);
         }
     }
     $db->freeResult($res);
     return $num_rows;
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:44,代码来源:Block.php

示例3: formatRow

 function formatRow($row)
 {
     $block = new Block();
     $block->initFromRow($row);
     return $this->mForm->formatRow($block);
 }
开发者ID:puring0815,项目名称:OpenKore,代码行数:6,代码来源:SpecialIpblocklist.php

示例4: enumBlocks

 function enumBlocks($callback, $tag, $flags = 0)
 {
     global $wgAntiLockFlags;
     $block = new Block();
     if ($flags & EB_FOR_UPDATE) {
         $db =& wfGetDB(DB_MASTER);
         if ($wgAntiLockFlags & ALF_NO_BLOCK_LOCK) {
             $options = '';
         } else {
             $options = 'FOR UPDATE';
         }
         $block->forUpdate(true);
     } else {
         $db =& wfGetDB(DB_SLAVE);
         $options = '';
     }
     $ipblocks = $db->tableName('ipblocks');
     $sql = "SELECT * FROM {$ipblocks} ORDER BY ipb_timestamp DESC {$options}";
     $res = $db->query($sql, 'Block::enumBans');
     while ($row = $db->fetchObject($res)) {
         $block->initFromRow($row);
         if (!($flags & EB_KEEP_EXPIRED)) {
             if (!$block->deleteIfExpired()) {
                 $callback($block, $tag);
             }
         } else {
             $callback($block, $tag);
         }
     }
     wfFreeResult($res);
 }
开发者ID:BackupTheBerlios,项目名称:enotifwiki,代码行数:31,代码来源:Block.php


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