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


PHP Mage_Core_Block_Abstract类代码示例

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


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

示例1: getBlockKey

 /**
  * Get the final block key used for caching
  *
  * @param Mage_Core_Block_Abstract $block
  * @return string
  */
 public function getBlockKey(Mage_Core_Block_Abstract $block)
 {
     $cacheKeys = array_values($block->getData('cache_keys'));
     $key = implode('|', $cacheKeys);
     $key = sha1($key);
     return $key;
 }
开发者ID:eneiasramos,项目名称:Made_Cache,代码行数:13,代码来源:Data.php

示例2: getBlockPlaceholder

 /**
  * Create placeholder object based on block information
  *
  * @param Mage_Core_Block_Abstract $block
  * @return Enterprise_PageCache_Model_Container_Placeholder
  */
 public function getBlockPlaceholder($block)
 {
     $this->_initPlaceholders();
     $type = $block->getType();
     if (isset($this->_placeholders[$type])) {
         $placeholderData = false;
         foreach ($this->_placeholders[$type] as $placeholderInfo) {
             if (!empty($placeholderInfo['name'])) {
                 if ($placeholderInfo['name'] == $block->getNameInLayout()) {
                     $placeholderData = $placeholderInfo;
                 }
             } else {
                 $placeholderData = $placeholderInfo;
             }
         }
         if (!$placeholderData) {
             return false;
         }
         $placeholder = $placeholderData['code'] . ' container="' . $placeholderData['container'] . '"' . ' block="' . get_class($block) . '"';
         $placeholder .= ' cache_id="' . $block->getCacheKey() . '"';
         foreach ($block->getCacheKeyInfo() as $k => $v) {
             if (is_string($k) && !empty($k)) {
                 $placeholder .= ' ' . $k . '="' . $v . '"';
             }
         }
         $placeholder = Mage::getModel('enterprise_pagecache/container_placeholder', $placeholder);
         return $placeholder;
     }
     return false;
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:36,代码来源:Config.php

示例3: _getTemplateNameFromBlock

 /**
  * Pull template name out of the block object
  *
  * @param  Mage_Core_Block_Abstract $block
  * @return string
  */
 protected function _getTemplateNameFromBlock($block)
 {
     $file = $block->getTemplateFile();
     $file = !preg_match('{/$}i', $file) ? $file : false;
     $file = $file ? $file : $block->getTemplate();
     return $file;
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:13,代码来源:Block.php

示例4: delayPrepareLayout

 /**
  * @param Mage_Core_Block_Abstract $block
  */
 public function delayPrepareLayout($block, $sortOrder = 0)
 {
     if ($this->_delayedLayoutIsBeingProcessed || Mage::registry('m_page_is_being_rendered')) {
         $block->delayedPrepareLayout();
     } else {
         $this->_delayPrepareLayoutBlocks[$block->getNameInLayout()] = compact('block', 'sortOrder');
     }
 }
开发者ID:xiaoguizhidao,项目名称:cupboardglasspipes.ecomitize.com,代码行数:11,代码来源:Layout.php

示例5: apply

 public function apply(Mage_Core_Block_Abstract $block)
 {
     $layout = $block->getLayout();
     if ($layout) {
         $keys = $block->getCacheKeys();
         $keys[] = $block->getLayout()->getUpdate()->getCacheId();
         $block->setCacheKeys($keys);
     }
 }
开发者ID:eneiasramos,项目名称:Made_Cache,代码行数:9,代码来源:Cacheid.php

示例6: apply

 public function apply(Mage_Core_Block_Abstract $block)
 {
     $helper = Mage::helper('cache');
     $keys = $block->getCacheKeys();
     foreach (Mage::app()->getRequest()->getParams() as $key => $value) {
         $value = $helper->paramValueToCacheKey($value);
         $keys[] = $key . '_' . $value;
     }
     $block->setCacheKeys($keys);
 }
开发者ID:eneiasramos,项目名称:Made_Cache,代码行数:10,代码来源:Request.php

示例7: hello

/**
* Specified by <view>hello</view>
*
* View function should return a $block, which will be automatically
* appended to the Page Layout's content block
*
* $block is a block object and will have a data member called 
* params which  contains the matched regular expressions from 
* <url_regex/>. The $block's class is controlled by <block_class/>.
* See simplepage.xml for more information.
*
* $layout is a reference to the Magento page layout object, and
* may be used to manipulated the existing layout. (add blocks, 
* unset them, change templates, etc.)
*
* $request and $response are the standard Magento request and response
* objects, in case you want to monkey with them. 
*
* @param Mage_Core_Block_Abstract $block
* @param Mage_Core_Model_Layout   $layout
* @param Mage_Core_Controller_Request_Http $request
* @param Mage_Core_Controller_Response_Http $response
* @return Mage_Core_Block_Template $block
*/
function hello($block, $layout, $request, $response)
{
    //in this example we're just setting a template on
    //the bock on returning it. Standard Magento theme
    //rules apply for template loading
    $block->setTemplate('pulsestorm_simplepage/example.phtml');
    //$layout->getBlock('left')->getParentBlock()->unsetChild('left');
    //$layout->getBlock('root')->setTemplate('page/1column.phtml');
    return $block;
}
开发者ID:itmyprofession,项目名称:Pulsestorm,代码行数:34,代码来源:simplepage.php

示例8: _getChildDataSourcesRecursively

 /**
  * @param Mana_Admin_Block_Data[] $result
  * @param Mage_Core_Block_Abstract $block
  */
 protected function _getChildDataSourcesRecursively(&$result, $block)
 {
     foreach ($block->getChild() as $child) {
         if ($child != $this) {
             if ($child instanceof Mana_Admin_Block_Data) {
                 $result[] = $child;
             } else {
                 $this->_getChildDataSourcesRecursively($result, $child);
             }
         }
     }
 }
开发者ID:axovel,项目名称:easycarcare,代码行数:16,代码来源:Data.php

示例9: _getBasicKeys

 /**
  * Get generic key array including handle etc, that all blocks use
  *
  * @param Mage_Core_Block_Abstract $block
  * @return array
  */
 protected function _getBasicKeys(Mage_Core_Block_Abstract $block)
 {
     $keys = $block->getCacheKeyInfo();
     if (!is_array($keys)) {
         $keys = array();
     }
     $keys[] = Mage::getSingleton('customer/session')->getCustomer()->getGroupId();
     $keys[] = Mage::app()->getStore()->getCurrentCurrencyCode();
     $keys[] = $block->getLayout()->getUpdate()->getCacheId();
     $keys[] = 'SSL_' . intval(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') . '_';
     return $keys;
 }
开发者ID:finelinePG,项目名称:finelink-dev,代码行数:18,代码来源:Abstract.php

示例10: injectChildBlocks

 /**
  * Inject child blocks
  *
  * @param $source
  * @param Mage_Core_Block_Abstract $block
  * @return mixed
  */
 public function injectChildBlocks($source, Mage_Core_Block_Abstract $block)
 {
     $count = null;
     $source = preg_replace_callback('/<!--\\s*###(.+)###\\s*-->(.*)<!--\\s*###\\/\\1###\\s*-->/s', function ($matches) use($block) {
         //if (Mage::getIsDeveloperMode()) {
         //    Mage::log('[Aoe_TemplateImport] Injecting block: ' . $matches[1]);
         //}
         return '<!-- BEGIN BLOCK: ' . $matches[1] . ' -->' . $block->getChildHtml($matches[1]) . '<!-- END BLOCK: ' . $matches[1] . ' -->';
     }, $source, -1, $count);
     //if (Mage::getIsDeveloperMode()) {
     //    Mage::log('[Aoe_TemplateImport] Match count: ' . $count);
     //}
     return $source;
 }
开发者ID:aoepeople,项目名称:aoe_templateimport,代码行数:21,代码来源:Source.php

示例11: getChildByType

 /**
  * Return first found child block of specified type, return false if not found
  * @param  Mage_Core_Block_Abstract $oParentBlock
  * @param  object $vType
  * @return bool
  */
 public function getChildByType(Mage_Core_Block_Abstract $oParentBlock, $vType)
 {
     $aChildrenBlocks = $oParentBlock->getChild();
     if (count($aChildrenBlocks)) {
         foreach ($aChildrenBlocks as $oBlock) {
             if ($oBlock instanceof $vType) {
                 return $oBlock;
             } elseif ($oGrandChild = $this->getChildByType($oBlock, $vType)) {
                 return $oGrandChild;
             }
         }
     }
     return false;
 }
开发者ID:aligent,项目名称:cacheobserver,代码行数:20,代码来源:Data.php

示例12: raise

 /**
  * @param Mage_Core_Block_Abstract $target
  * @param string[] $handlers
  * @param array $params
  * @return mixed
  */
 public function raise($target, $handlers, $params = array())
 {
     if (!empty($handlers)) {
         $event = new Varien_Object(array_merge($params, array('target' => $target, 'result' => false, 'stop_event_handling' => false)));
         foreach ($handlers as $handler) {
             $handler = explode('::', $handler);
             if ($object = $target->getLayout()->getBlock($handler[0])) {
                 $method = $handler[1];
                 $event->setResult($object->{$method}($event));
                 if ($event->getStopEventHandling()) {
                     break;
                 }
             }
         }
         return $event->getResult();
     } else {
         return false;
     }
 }
开发者ID:axovel,项目名称:easycarcare,代码行数:25,代码来源:Event.php

示例13: _afterToHtml

 protected function _afterToHtml($html)
 {
     $html = parent::_afterToHtml($html);
     $transport = new Varien_Object(array('html' => $html));
     Mage::dispatchEvent('aitsys_block_abstract_to_html_after', array('block' => $this, 'transport' => $transport));
     return $transport->getHtml();
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:7,代码来源:Abstract.php

示例14: _generateBlock

 /**
  * Records information about new block creation
  * (non-PHPdoc)
  * @see Mage_Core_Model_Layout::_generateBlock()
  */
 protected function _generateBlock($node, $parent)
 {
     $this->_collectedBlock = null;
     parent::_generateBlock($node, $parent);
     if ($this->_collectedBlock !== null) {
         $target = $this->_collectedBlock->getNameInLayout();
         $params = array();
         if (isset($node['as'])) {
             $params['alias'] = (string) $node['as'];
         } else {
             $params['alias'] = $target;
         }
         if (isset($node['class'])) {
             $params['type'] = (string) $node['class'];
         } elseif (isset($node['type'])) {
             $params['type'] = (string) $node['type'];
         }
         $params['class'] = get_class($this->_collectedBlock);
         $params['is_root'] = isset($node['output']);
         $this->record(self::ACTION_BLOCK_CREATED, $target, $params);
         if (isset($node['template'])) {
             $this->record(self::ACTION_BLOCK_ACTION, $target . '::setTemplate', array('template' => (string) $node['template']));
         }
     }
     return $this;
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:31,代码来源:Layout.php

示例15: _toHtml

 protected function _toHtml()
 {
     $standard = Mage::getModel('ep/initialize');
     $code = 'payment_block_' . $standard->getCode();
     $html = parent::_toHtml();
     $html .= '<p class="redirect-payment">' . $this->__('Sunteţi redirecţionat către modulul de plată, unde veţi putea introduce detaliile cardului dvs pentru a putea finaliza tranzacţia.') . "</p>";
     $html .= '<form name="' . $code . '" id="' . $code . '" method="POST" action="' . $standard->getUrl() . ($this->getNewwindow() ? ' target="' . strtoupper($code) . '"' : '') . '">';
     $formFields = $standard->getCheckoutFormFields();
     if (is_array($formFields)) {
         foreach ($formFields as $field => $value) {
             if (is_array($value)) {
                 if (count($value)) {
                     foreach ($value as $subvalue) {
                         $html .= '<input type="hidden" name="' . $field . '[]" value="' . $subvalue . '" />' . "\n";
                     }
                 }
             } else {
                 $html .= '<input type="hidden" name="' . $field . '" value="' . $value . '" />' . "\n";
             }
         }
     }
     $html .= '<p class="redirect-payment-button"><button type="submit">' . $this->__('Finalizează comanda') . '<sup>*</sup></button></p> <p class="redirect-payment"><sup>*</sup>' . $this->__('Daca nu sunteti redirectionat automat apasati "Finalizeaza comanda" pentru a putea finaliza tranzactia.') . '</p></form>' . "\n";
     if ('www' == substr($_SERVER['HTTP_HOST'], 0, 3)) {
         $html .= '<script type="text/javascript">document.getElementById("' . $code . '").submit();</script>';
     }
     return $html;
 }
开发者ID:picode-eu,项目名称:nti_mage,代码行数:27,代码来源:Payment.php


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