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


PHP Block::delete方法代码示例

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


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

示例1: getAdminInterface

 /**
  * Build and return admin interface
  * 
  * Any module providing an admin interface is required to have this function, which
  * returns a string containing the (x)html of it's admin interface.
  * @return string
  */
 function getAdminInterface()
 {
     switch (@$_REQUEST['section']) {
         case 'toggle':
             $block = new Block($_REQUEST['id']);
             if ($block->getStatus() == 'active') {
                 $block->setStatus('inactive');
                 $block->save();
             } else {
                 $block->setStatus('active');
                 $block->save();
             }
             return $this->topLevelAdmin();
             break;
         case 'addedit':
             $block = new Block(@$_REQUEST['blocks_id']);
             $form = $block->getAddEditForm();
             if ($form->validate() && $form->isSubmitted() && isset($_REQUEST['blocks_submit'])) {
                 return $this->topLevelAdmin();
             } else {
                 return $block->getAddEditForm()->display();
             }
             break;
         case 'delete':
             $block = new Block(@$_REQUEST['blocks_id']);
             $block->delete();
             return $this->topLevelAdmin();
             break;
         default:
             return $this->topLevelAdmin();
     }
 }
开发者ID:swat30,项目名称:safeballot,代码行数:39,代码来源:Blocks.php

示例2: test_delete_block

 public function test_delete_block()
 {
     $params = array('title' => $this->title, 'type' => $this->type);
     $block = new Block($params);
     $block->insert();
     $count = DB::get_value('SELECT count(*) FROM {blocks}');
     $block->delete();
     $this->assert_equal($count - 1, DB::get_value('SELECT count(*) FROM {blocks}'), 'Count of blocks should decrease by one');
 }
开发者ID:habari,项目名称:tests,代码行数:9,代码来源:test_block.php

示例3: doSubmit

 function doSubmit()
 {
     global $wgOut;
     $block = new Block();
     $this->ip = trim($this->ip);
     if ($this->ip[0] == "#") {
         $block->mId = substr($this->ip, 1);
     } else {
         $block->mAddress = $this->ip;
     }
     # Delete block (if it exists)
     # We should probably check for errors rather than just declaring success
     $block->delete();
     # Make log entry
     $log = new LogPage('block');
     $log->addEntry('unblock', Title::makeTitle(NS_USER, $this->ip), $this->reason);
     # Report to the user
     $titleObj = Title::makeTitle(NS_SPECIAL, "Ipblocklist");
     $success = $titleObj->getFullURL("action=success&ip=" . urlencode($this->ip));
     $wgOut->redirect($success);
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:21,代码来源:SpecialIpblocklist.php

示例4: deleteBlock

 private function deleteBlock($id_block = null)
 {
     if (is_null($id_block)) {
         return false;
     }
     $items = $this->getItemByBlock($id_block);
     $del = true;
     if ($items && count($items) > 0) {
         foreach ($items as $it) {
             $item = new Item($it['id_item']);
             $del &= $item->delete();
         }
     }
     if ($del) {
         $block = new Block($id_block);
         return $block->delete();
     }
     return false;
 }
开发者ID:abdoumej,项目名称:libsamy,代码行数:19,代码来源:advancetopmenu.php

示例5: 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

示例6: testIsMarkingBlockForDeletion

 public function testIsMarkingBlockForDeletion()
 {
     $memory = new Block(897);
     $memory->delete();
     $data = $memory->read();
     $this->assertEquals('Sample 2', $data);
 }
开发者ID:swordkee,项目名称:phalcon-demo,代码行数:7,代码来源:Block.php


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