/** * Get Placeholder Block * * @return Mage_Core_Block_Abstract */ protected function _getPlaceHolderBlock() { if (null === $this->_placeholderBlock) { $blockName = $this->_placeholder->getAttribute('block'); $this->_placeholderBlock = new $blockName(); $this->_placeholderBlock->setTemplate($this->_placeholder->getAttribute('template')); $this->_placeholderBlock->setLayout(Mage::app()->getLayout()); $this->_placeholderBlock->setSkipRenderTag(true); } return $this->_placeholderBlock; }
/** * Retrieve placeholder replacer * * @param array $matches Matches by preg_replace_callback * @return string */ protected function _getPlaceholderReplacer($matches) { return $this->_placeholder->getReplacer(); }
/** * Process Containers * * @param $content * @return array */ protected function _processContainers(&$content) { $placeholders = array(); preg_match_all(Ves_Optimize_Model_Container_Placeholder::HTML_NAME_PATTERN, $content, $placeholders, PREG_PATTERN_ORDER); $placeholders = array_unique($placeholders[1]); $containers = array(); foreach ($placeholders as $definition) { $placeholder = new Ves_Optimize_Model_Container_Placeholder($definition); $container = $placeholder->getContainerClass(); if (!$container) { continue; } $container = new $container($placeholder); $container->setProcessor($this); if (!$container->applyWithoutApp($content)) { $containers[] = $container; } else { preg_match($placeholder->getPattern(), $content, $matches); if (array_key_exists(1, $matches)) { $containers = array_merge($this->_processContainers($matches[1]), $containers); $content = preg_replace($placeholder->getPattern(), str_replace('$', '\\$', $matches[1]), $content); } } } return $containers; }