本文整理汇总了PHP中Mage_Core_Block_Text类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Block_Text类的具体用法?PHP Mage_Core_Block_Text怎么用?PHP Mage_Core_Block_Text使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Core_Block_Text类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _beforeToHtml
public function _beforeToHtml()
{
$block_1 = new Mage_Core_Block_Text();
$block_1->setText('The first sentence.');
$this->setChild('the_first', $block_1);
$block_2 = new Mage_Core_Block_Text();
$block_2->setText('The second sentence .');
$this->setChild('the_second', $block_2);
}
示例2: update
/**
* Update specified argument
*
* @param Mage_Core_Block_Text $argument
* @return Mage_Core_Block_Text
*/
public function update($argument)
{
$calls = $argument->getUpdaterCall();
if (true == empty($calls)) {
$calls = array();
}
$calls[] = 'updater call';
$argument->setUpdaterCall($calls);
return $argument;
}
示例3: manejandobloquesAction
public function manejandobloquesAction()
{
$block_1 = new Mage_Core_Block_Text();
$block_1->setText('Original Text');
$block_2 = new Mage_Core_Block_Text();
$block_2->setText('The second sentence.');
$main_block = new Mage_Core_Block_Template();
$main_block->setTemplate('nofrills/manejandobloques.phtml');
$main_block->setChild('the_first', $block_1);
$main_block->setChild('the_second', $block_2);
$block_1->setText('Wait , I want this text instead .');
echo $main_block->toHtml();
}
示例4: testGetOutput
/**
* @covers Mage_Core_Model_Layout::addBlock
* @covers Mage_Core_Model_Layout::addOutputBlock
* @covers Mage_Core_Model_Layout::getOutput
* @covers Mage_Core_Model_Layout::removeOutputBlock
*/
public function testGetOutput()
{
$blockName = 'block_' . __METHOD__;
$expectedText = "some_text_for_{$blockName}";
$block = new Mage_Core_Block_Text();
$block->setText($expectedText);
$this->_model->addBlock($block, $blockName);
$this->_model->addOutputBlock($blockName);
$this->assertEquals($expectedText, $this->_model->getOutput());
$this->_model->removeOutputBlock($blockName);
$this->assertEmpty($this->_model->getOutput());
}
示例5: testAddBlock
public function testAddBlock()
{
$this->assertInstanceOf('Mage_Core_Block_Text', $this->_layout->addBlock('Mage_Core_Block_Text', 'block1'));
$block2 = new Mage_Core_Block_Text();
$block2->setNameInLayout('block2');
$this->_layout->addBlock($block2, '', 'block1');
$this->assertTrue($this->_layout->hasElement('block1'));
$this->assertTrue($this->_layout->hasElement('block2'));
$this->assertEquals('block1', $this->_layout->getParentName('block2'));
}
示例6: _beforeToHtml
/**
* Generate the JS required to load the update routine
*
* @return $this
*/
protected function _beforeToHtml()
{
$current = str_replace('.', '_', Mage::helper('wordpress/system')->getExtensionVersion());
$text = implode('', array('<script type="text/javascript">', sprintf("var WP_VERSION_LATEST = '%s';", $latestVersion = Mage::app()->getCache()->load('wordpress_integration_update' . $current)), sprintf("var WP_VERSION_CURRENT = '%s';", Mage::helper('wordpress/system')->getExtensionVersion()), sprintf("var WP_VERSION_LOOKUP_URL = '%s';", $this->getUrl('adminhtml/wordpress/checkVersion')), 'new fishpig.WP.Update();', '</script>'));
$this->setText($text);
return parent::_beforeToHtml();
}
示例7: _toHtml
protected function _toHtml()
{
$this->setText('');
$layout = $this->getLayout();
foreach ($this->getChildNames() as $child) {
$this->addText($layout->renderElement($child));
}
return parent::_toHtml();
}
示例8: _toHtml
protected function _toHtml()
{
$this->setText('<' . $this->getTagName() . ' ');
if ($this->getTagParams()) {
foreach ($this->getTagParams() as $k => $v) {
$this->addText($k . '="' . $v . '" ');
}
}
$this->addText('>' . $this->getTagContents() . '</' . $this->getTagName() . '>' . "\r\n");
return parent::_toHtml();
}
示例9: _toHtml
protected function _toHtml()
{
$this->setText('');
foreach ($this->getSortedChildren() as $name) {
$block = $this->getLayout()->getBlock($name);
if (!$block) {
Mage::throwException(Mage::helper('core')->__('Invalid block: %s', $name));
}
$this->addText($block->toHtml());
}
return parent::_toHtml();
}
示例10: _toHtml
protected function _toHtml()
{
if (!$this->getContentType()) {
$this->setContentType('text/html; charset=utf-8');
}
$this->addText('<meta http-equiv="Content-Type" content="' . $this->getContentType() . '"/>' . "\n");
$this->addText('<title>' . $this->getTitle() . '</title>' . "\n");
$this->addText('<meta name="title" content="' . $this->getTitle() . '"/>' . "\n");
$this->addText('<meta name="description" content="' . $this->getDescription() . '"/>' . "\n");
$this->addText('<meta name="keywords" content="' . $this->getKeywords() . '"/>' . "\n");
$this->addText('<meta name="robots" content="' . $this->getRobots() . '"/>' . "\n");
return parent::_toHtml();
}
示例11: _toHtml
protected function _toHtml()
{
$this->setText('<li');
$params = $this->getLiParams();
if (!empty($params) && is_array($params)) {
foreach ($params as $key => $value) {
$this->addText(' ' . $key . '="' . addslashes($value) . '"');
}
} elseif (is_string($params)) {
$this->addText(' ' . $params);
}
$this->addText('>' . $this->getInnerText() . '</li>' . "\r\n");
return parent::_toHtml();
}
示例12: _toHtml
protected function _toHtml()
{
$this->setText('');
foreach ($this->getSortedChildren() as $name) {
$block = $this->getLayout()->getBlock($name);
if (!$block) {
Mage::throwException(Mage::helper('core')->__('Invalid block: %s', $name));
}
$move = ' move-xs';
if (str_replace('.', '_', $name) == 'ev_leftmenu') {
$move = ' catalog active';
}
if ($this->getNameInLayout() == 'left') {
$this->addText('<div id="Navigation_panel_' . str_replace('.', '_', $name) . '" class="navigation_panel' . $move . '">');
}
$this->addText($block->toHtml());
if ($this->getNameInLayout() == 'left') {
$this->addText('</div>');
}
}
return parent::_toHtml();
}
示例13: _toHtml
protected function _toHtml()
{
$config = Mage::getSingleton('pap/config');
if (!$config->getTrackClicks()) {
return '';
}
ob_start();
?>
<script type="text/javascript">
(function () {
var papDomain = (("https:" == document.location.protocol) ? "https://":"http://");papDomain+="<?php
echo preg_replace('~^(https?://)?~', '', $config->getRemotePath());
?>
";
var papId = 'pap_x2s6df8d';
// adjust the ID iff it would conflict with an existing element
if ((function(elementId){var nodes=new Array();var tmpNode=document.getElementById(elementId);while(tmpNode){nodes.push(tmpNode);tmpNode.id="";tmpNode=document.getElementById(elementId);for(var x=0;x<nodes.length;x++){if(nodes[x]==tmpNode){tmpNode=false;}}}})('pap_x2s6df8d')) {papId += '_clicktrack';}
document.write(unescape("%3Cscript id='pap_x2s6df8d' src='" + papDomain + "/scripts/<?php
echo $config->getTrackclickscript();
?>
' type='text/javascript'%3E%3C/script%3E"));
})();
</script>
<?php
$script_block = ob_get_clean();
$this->addText('
<!-- BEGIN AFFILIATE TRACKING CODE -->
' . $script_block . '
<script type="text/javascript">
<!--
papTrack();
//-->
</script>
<!-- END AFFILIATE TRACKING CODE -->
');
/* Asynchronous version. We can't use this currently because the tracking script uses document.write, and
that causes problems if the page is already fully loaded. Chrome also has security issues with asynchronous
document.write.
QualityUnit has been asked to update the script to allow for this.
$this->addText('
<!-- BEGIN AFFILIATE TRACKING CODE -->
<script type="text/javascript">
(function() {
var pap_script = document.createElement("script"); pap_script.type = "text/javascript"; pap_script.async = true;
pap_script.id = "'.$id.'";
pap_script.src = "'.$config->getRemotePath().'/scripts/'.$config->getTrackclickscript().'";
var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(pap_script, s);
})();
var pap_script_init = function()
{
if(typeof papTrack == "function")
{
clearInterval(pap_script_init_interval);
papTrack();
}
}
pap_script_init_interval = setInterval("pap_script_init()", 100);
</script>
<!-- END AFFILIATE TRACKING CODE -->
');
*/
return parent::_toHtml();
}
示例14: _toHtml
protected function _toHtml()
{
$config = Mage::getSingleton('pap/config');
if (!$config->getTrackSales('javascript')) {
return '';
// not allowed to track via Javascript
}
// Get the quote
$quote = $this->getQuote();
if ($quote) {
// from there, get the quote ID
if ($quote instanceof Mage_Sales_Model_Quote) {
$quoteId = $quote->getId();
} else {
$quoteId = $quote;
}
} else {
// Shouldn't happen, but Magento 1.4 has a bug that can cause problems
// if the customer registers an account at checkout, so this will help
// work around the problem.
$quoteId = Mage::getSingleton('checkout/session')->getLastQuoteId();
}
if (!$quoteId) {
return '';
}
// Get the order(s) for the quote
$orders = Mage::getResourceModel('sales/order_collection')->addAttributeToFilter('quote_id', $quoteId)->load();
// get raw data to submit from the collection of orders
$items = array();
foreach ($orders as $order) {
if (!$order) {
continue;
}
if (!$order instanceof Mage_Sales_Model_Order) {
$order = Mage::getModel('sales/order')->load($order);
}
if (!$order) {
continue;
}
$order = Mage::getModel('pap/pap')->getOrderSaleDetails($order);
array_splice($items, -1, 0, $order);
}
ob_start();
?>
<script type="text/javascript">
(function () {
var papDomain = (("https:" == document.location.protocol) ? "https://":"http://");papDomain+="<?php
echo preg_replace('~^(https?://)?~', '', $config->getRemotePath());
?>
";
var papId = 'pap_x2s6df8d';
// adjust the ID iff it would conflict with an existing element
if ((function(elementId){var nodes=new Array();var tmpNode=document.getElementById(elementId);while(tmpNode){nodes.push(tmpNode);tmpNode.id="";tmpNode=document.getElementById(elementId);for(var x=0;x<nodes.length;x++){if(nodes[x]==tmpNode){tmpNode=false;}}}})('pap_x2s6df8d')) {papId += '_salestrack';}
document.write(unescape("%3Cscript id='pap_x2s6df8d' src='" + papDomain + "/scripts/<?php
echo $config->getTracksalescript();
?>
' type='text/javascript'%3E%3C/script%3E"));
})();
</script>
<?php
$script_block = ob_get_clean();
// Build the script for this order information
ob_start();
?>
<?php
echo $script_block;
?>
<script type="text/javascript">
<?php
foreach ($items as $idx => $item) {
$sale = "pap_sale" . $idx;
// calculated var name for each part of the sale
?>
var <?php
echo $sale;
?>
= PostAffTracker.createSale();
<?php
echo $sale;
?>
.setTotalCost('<?php
echo addslashes($item['totalcost']);
?>
');
<?php
echo $sale;
?>
.setOrderID('<?php
echo addslashes($item['orderid']);
?>
');
<?php
if ($item['data1']) {
?>
<?php
echo $sale;
?>
.setData1('<?php
echo addslashes($item['data1']);
?>
//.........这里部分代码省略.........
示例15: _prepareLayout
/**
* Add the JS
*
* @return $this
*/
protected function _prepareLayout()
{
$this->setText(sprintf("\n\t\t\t<script type=\"text/javascript\">\n\t\t\t\t//<![CDATA[\t\t\t\t\n\t\t\t\t\t(function() {\n\t\t\t\t\t\tvar create = {\n\t\t\t\t\t\t\tgo: function() {\n\t\t\t\t\t\t\t\tthis.attr = \$('splash_attribute_id');\n\t\t\t\t\t\t\t\tthis.opt = \$('splash_option_id');\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (!this.attr || !this.opt) {\n\t\t\t\t\t\t\t\t\tthrow 'Missing required input fields';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tthis.name = \$('splash_display_name');\n\n\t\t\t\t\t\t\t\tthis.options = new Array();\n\t\t\t\t\t\t\t\tthis.onAttributeChange();\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tthis.attr.observe('change', this.onAttributeChange.bindAsEventListener(this));\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tthis.opt.observe('change', this.onOptionChange.bindAsEventListener(this));\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thasOptions: function() {\n\t\t\t\t\t\t\t\treturn typeof this.options[this.attr.getValue()] !== 'undefined';\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tupdateOptions: function() {\n\t\t\t\t\t\t\t\tthis.opt.options = null;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tthis.opt.options[0] = new Option('%s', '');\n\n\t\t\t\t\t\t\t\tthis.options[this.attr.getValue()].each(function(elem, ind) {\n\t\t\t\t\t\t\t\t\tthis.opt.options[ind+1] = new Option(elem.label, elem.value);\n\t\t\t\t\t\t\t\t}.bind(this));\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgetOptions: function() {\n\t\t\t\t\t\t\t\tnew Ajax.Request('%s?attribute=' + this.attr.getValue(), {\n\t\t\t\t\t\t\t\t\tonSuccess: function(transport) {\n\t\t\t\t\t\t\t\t\t\tvar json = transport.responseText.evalJSON();\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tif (json.error) {\n\t\t\t\t\t\t\t\t\t\t\tthrow json.error;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tthis.options[this.attr.getValue()] = new Array();\n\n\t\t\t\t\t\t\t\t\t\tjson.options.each(function(elem, ind) {\n\t\t\t\t\t\t\t\t\t\t\tthis.options[this.attr.getValue()].push({'value': elem.value, 'label': elem.label});\n\t\t\t\t\t\t\t\t\t\t}.bind(this));\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tthis.updateOptions();\n\t\t\t\t\t\t\t\t\t}.bind(this)\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonAttributeChange: function() {\n\t\t\t\t\t\t\t\tif (this.hasOptions()) {\n\t\t\t\t\t\t\t\t\tthis.updateOptions();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tthis.getOptions();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonOptionChange: function() {\n\t\t\t\t\t\t\t\tif (this.opt.getValue()) {\n\t\t\t\t\t\t\t\t\tif (this.name.getValue() === '') {\n\t\t\t\t\t\t\t\t\t\tthis.name.setValue(this.opt.options[this.opt.selectedIndex].label);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t\t\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\treturn create.go();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (e) {\n\t\t\t\t\t\t\talert(e);\n\t\t\t\t\t\t}\n\t\t\t\t\t})();\n\t\t\t\t//]]>\n\t\t\t</script>\n\t\t", Mage::helper('adminhtml')->__('-- Please Select --'), Mage::getModel('adminhtml/url')->getUrl('*/*/options')));
return parent::_prepareLayout();
}