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


PHP Block类代码示例

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


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

示例1: onActivate

 public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz)
 {
     if ($this->meta === AIR) {
         if ($target instanceof LiquidBlock) {
             $level->setBlock($target, new AirBlock(), true, false, true);
             if (($player->gamemode & 0x1) === 0) {
                 $this->meta = $target instanceof WaterBlock ? WATER : LAVA;
             }
             return true;
         }
     } elseif ($this->meta === WATER) {
         //Support Make Non-Support Water to Support Water
         if ($block->getID() === AIR || $block instanceof WaterBlock && ($block->getMetadata() & 0x7) != 0x0) {
             $water = new WaterBlock();
             $level->setBlock($block, $water, true, false, true);
             $water->place(clone $this, $player, $block, $target, $face, $fx, $fy, $fz);
             if (($player->gamemode & 0x1) === 0) {
                 $this->meta = 0;
             }
             return true;
         }
     } elseif ($this->meta === LAVA) {
         if ($block->getID() === AIR) {
             $level->setBlock($block, new LavaBlock(), true, false, true);
             if (($player->gamemode & 0x1) === 0) {
                 $this->meta = 0;
             }
             return true;
         }
     }
     return false;
 }
开发者ID:ungarscool1,项目名称:Multicraft,代码行数:32,代码来源:Bucket.php

示例2: setPermissionObject

 public function setPermissionObject(Block $b)
 {
     $this->permissionObject = $b;
     // if the area overrides the collection permissions explicitly (with a one on the override column) we check
     if ($b->overrideAreaPermissions()) {
         $this->permissionObjectToCheck = $b;
     } else {
         $a = $b->getBlockAreaObject();
         if (is_object($a)) {
             if ($a->overrideCollectionPermissions()) {
                 $this->permissionObjectToCheck = $a;
             } elseif ($a->getAreaCollectionInheritID()) {
                 $mcID = $a->getAreaCollectionInheritID();
                 $mc = Page::getByID($mcID, 'RECENT');
                 $ma = Area::get($mc, $a->getAreaHandle());
                 if ($ma->overrideCollectionPermissions()) {
                     $this->permissionObjectToCheck = $ma;
                 } else {
                     $this->permissionObjectToCheck = $ma->getAreaCollectionObject();
                 }
             } else {
                 $this->permissionObjectToCheck = $a->getAreaCollectionObject();
             }
         } else {
             $this->permissionObjectToCheck = Page::getCurrentPage();
         }
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:28,代码来源:block.php

示例3: test_hidden

 function test_hidden()
 {
     // Reads from test/templates/block-test.php
     $block = new Block('test');
     $block->hidden = TRUE;
     $this->assertEqual('', $block->render());
 }
开发者ID:bufvc,项目名称:bufvc-potnia-framework,代码行数:7,代码来源:testBlock.php

示例4: parseBlock

 protected function parseBlock($lines, $current = 0)
 {
     //printf("parseBlock: line %s\n", $current);
     $rootBlock = new Block('[root]');
     for ($i = $current, $count = count($lines); $i < $count; $i++) {
         $line = trim($lines[$i]);
         $line = $this->stripComment($line);
         if ($line === '' || $line[0] === '#') {
             //printf("parseBlock: skip line %s\n", $i);
             continue;
         }
         if ($line[strlen($line) - 1] === '{') {
             list($block, $i) = $this->parseBlock($lines, ++$i);
             if ($block !== false) {
                 list($name, $value) = $this->parseLine($line);
                 $block->name = $name;
                 $block->value = $value;
                 $rootBlock->addBlock($block);
             }
             continue;
         }
         if ($line === '}') {
             return [$rootBlock, $i];
         }
         list($property, $i) = $this->parseProperty($lines, $i);
         if ($property !== false) {
             $rootBlock->addProperty($property);
         }
     }
     return $rootBlock;
 }
开发者ID:gitstream,项目名称:nginx-parser,代码行数:31,代码来源:Parser.php

示例5: headerNav

 function headerNav()
 {
     include "config/site.php";
     require_once 'model/Block.php';
     $block = new Block();
     $blocks = $block->getBlocks();
     require "{$tpl_root}/_header_nav.php";
 }
开发者ID:puregamexyz,项目名称:bitdesign.github.io,代码行数:8,代码来源:HomeController.php

示例6: removeBlock

 /**
  * Remove block from composition
  *
  * @param Block $blockToRemove
  */
 public function removeBlock(Block $blockToRemove)
 {
     foreach ($this->blocks as $key => $block) {
         if ($block->getName() === $blockToRemove->getName()) {
             unset($this->blocks[$key]);
         }
     }
 }
开发者ID:konopelkosergeyv,项目名称:test,代码行数:13,代码来源:CompositeBlock.php

示例7: renderBlocks

 private function renderBlocks()
 {
     $this->aRenderedBlocks = array();
     foreach ($this->aBlocks as $sBlock) {
         // New block object
         $oBlock = new Block($sBlock, $this->aPageConfig, $this->sConfigFile);
         $this->aRenderedBlocks[$oBlock->getName()] = $oBlock->render();
     }
 }
开发者ID:rbnvrw,项目名称:crispus,代码行数:9,代码来源:Theme.php

示例8: append

 public function append(Block $block)
 {
     if ($this->numBlocks > 0) {
         $last = $this->numBlocks - 1;
         $this->blocks[$last]->setNextHash($block->getHash());
     }
     $this->numBlocks++;
     $this->blocks[] = $block;
 }
开发者ID:csirac2,项目名称:asgard-client,代码行数:9,代码来源:BlockChain.php

示例9: action_theme_activated

 /**
  * On theme activation, activate some default blocks
  */
 public function action_theme_activated()
 {
     $blocks = $this->get_blocks('primary', '', $this);
     if (count($blocks) == 0) {
         $block = new Block(array('title' => _t('Posts'), 'type' => 'grayposts'));
         $block->add_to_area('primary');
         Session::notice(_t('Added default blocks to theme areas.'));
     }
 }
开发者ID:habari-extras,项目名称:gray,代码行数:12,代码来源:theme.php

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

示例11: action_theme_activated

 /**
  * Add the K2 menu block to the nav area upon theme activation if there's nothing already there
  */
 public function action_theme_activated()
 {
     $blocks = $this->get_blocks('nav', 0, $this);
     if (count($blocks) == 0) {
         $block = new Block(array('title' => _t('K2 Menu'), 'type' => 'k2_menu'));
         $block->add_to_area('nav');
         Session::notice(_t('Added K2 Menu block to Nav area.'));
     }
 }
开发者ID:ringmaster,项目名称:system,代码行数:12,代码来源:theme.php

示例12: addDBData

 public function addDBData()
 {
     for ($i = 1; $i <= 4; $i++) {
         $this->localUsers[] = $this->getMutableTestUser()->getUser();
     }
     $sysop = static::getTestSysop()->getUser();
     $block = new Block(['address' => $this->localUsers[2]->getName(), 'by' => $sysop->getId(), 'reason' => __METHOD__, 'expiry' => '1 day', 'hideName' => false]);
     $block->insert();
     $block = new Block(['address' => $this->localUsers[3]->getName(), 'by' => $sysop->getId(), 'reason' => __METHOD__, 'expiry' => '1 day', 'hideName' => true]);
     $block->insert();
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:11,代码来源:LocalIdLookupTest.php

示例13: place

 public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz)
 {
     if (($target->isTransparent === false or $target->getID() === SLAB) and $face !== 0 and $face !== 1) {
         $faces = array(2 => 0, 3 => 1, 4 => 2, 5 => 3);
         $this->meta = $faces[$face] & 0x3;
         if ($fy > 0.5) {
             $this->meta |= 0x8;
         }
         $this->level->setBlock($block, $this, true, false, true);
         return true;
     }
 }
开发者ID:ungarscool1,项目名称:Multicraft,代码行数:12,代码来源:Trapdoor.php

示例14: indexAction

 public function indexAction()
 {
     $collection = $this->getModel()->getCollection();
     $params = $this->getParams();
     $list = new Block('templates/' . $params['controller'] . '/index.php');
     $list->setVar('collection', $collection);
     $labels = $this->getEntityLabels();
     $layout = $this->layout;
     $layout->setVar('title', $labels[1]);
     $layout->setChild('body', $list);
     $layout->render();
 }
开发者ID:Jaleko,项目名称:php-framework,代码行数:12,代码来源:CrudController.php

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


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