• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Block类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: smarty_function_create_block

function smarty_function_create_block($params, &$smarty)
{
    global $smarty_blocks;
    $block = new Block($params['name']);
    $block->set_content($params['content']);
    $block->output(false);
    $smarty_blocks[$params['name']] = $block;
    if (isset($params['parent'])) {
        $smarty_blocks[$params['parent']]->add_block($block);
    }
    return "";
    //return "qweqwe";
}
开发者ID:hyrmedia,项目名称:builderengine,代码行数:13,代码来源:function.create_block.php


示例17: testInterpretReferenceBlockDirective

 public function testInterpretReferenceBlockDirective()
 {
     $pageXml = new \Magento\Framework\View\Layout\Element(__DIR__ . '/_files/_layout_update_reference.xml', 0, true);
     $parentElement = new \Magento\Framework\View\Layout\Element('<page></page>');
     foreach ($pageXml->xpath('body/*') as $element) {
         $this->assertTrue(in_array($element->getName(), $this->block->getSupportedNodes()));
         $this->block->interpret($this->readerContext, $element, $parentElement);
     }
     $structure = $this->readerContext->getScheduledStructure();
     $this->assertArrayHasKey($this->blockName, $structure->getStructure());
     $this->assertEquals('block', $structure->getStructure()[$this->blockName][self::IDX_TYPE]);
     $resultElementData = $structure->getStructureElementData($this->blockName);
     $this->assertEquals(['test_arg' => 'test-argument-value'], $resultElementData['arguments']);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:BlockTest.php


示例18: addBlock

 public static function addBlock($blocker, $to_block)
 {
     if ($blocker == $to_block) {
         // Blocking yourself would be stupid, don't do it.
         return;
     }
     $block = new Block();
     $block->blocking_user_id = $blocker;
     $block->blocked_user_id = $to_block;
     $block->save();
     # Take the blocker of the blocked autoread
     $q = Doctrine_Query::create()->update("Autofinger")->set("updated", 0)->where("interest = ?", $blocker)->andWhere("owner = ?", $to_block);
     $q->execute();
 }
开发者ID:acohn,项目名称:grinnellplans-php,代码行数:14,代码来源:Block.php


示例19: efPowersMakeUnblockable

/**
 * @param Block $block
 * @param $user
 * @return bool
 */
function efPowersMakeUnblockable($block, $user)
{
    $blockedUser = User::newFromName($block->getRedactedName());
    if (empty($blockedUser) || !$blockedUser->isAllowed('unblockable')) {
        return true;
    }
    /* $wgMessageCache was removed in ME 1.18
    	global $wgMessageCache;
    	// hack to get IpBlock to display the message we want -- hardcoded in core code
    	$replacement = wfMsgExt( 'staffpowers-ipblock-abort', array('parseinline') );
    	$wgMessageCache->addMessages( array( 'hookaborted' => $replacement ) );
    	*/
    wfRunHooks('BlockIpStaffPowersCancel', array($block, $user));
    return false;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:20,代码来源:StaffPowers.php


示例20: executeCreate

 public function executeCreate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST));
     $bPost = $request->getParameter('block');
     $bData = new BlockData();
     $bData->fromArray($bPost['block_data']);
     $bPosition = new BlockPosition();
     $bPosition->fromArray($bPost['block_position']);
     $block = new Block();
     $block->set('BlockData', $bData);
     $block->set('BlockPosition', $bPosition);
     $block->save();
     $this->block = $block;
     $this->setTemplate('show');
 }
开发者ID:notjosh,项目名称:sup,代码行数:15,代码来源:actions.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP BlockController类代码示例发布时间:2022-05-23
下一篇:
PHP Blade类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap