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


PHP Varien_Event_Observer::getTransport方法代码示例

本文整理汇总了PHP中Varien_Event_Observer::getTransport方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Event_Observer::getTransport方法的具体用法?PHP Varien_Event_Observer::getTransport怎么用?PHP Varien_Event_Observer::getTransport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Varien_Event_Observer的用法示例。


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

示例1: core_block_abstract_to_html_after

 public function core_block_abstract_to_html_after(Varien_Event_Observer $observer)
 {
     $block = $observer->getBlock();
     if ($block instanceof Mage_Catalog_Block_Product_List) {
         /* will insert layered navigation block on top of the products list.. */
         $_block_code = $block->getNameInLayout();
         if (!in_array($_block_code, array("product_list", "search_result_list"))) {
             return;
         }
         $transport = $observer->getTransport();
         $html = $transport->getHtml();
         $html = '<div id="ajaxlist-reload-product_list">' . Mage::registry("top_layered_navigation_html") . $html . "</div>";
         $transport->setHtml($html);
     } elseif ($block instanceof Mage_Catalog_Block_Product_Compare_Abstract) {
         $_block_code = $block->getNameInLayout();
         if (!Mage::registry("ajaxcompare_check_code")) {
             $_check_code = explode(",", Mage::getStoreConfig("ajaxlist/ajaxcompare/reload_block"));
             Mage::register("ajaxcompare_check_code", $_check_code);
         }
         $_check_code = Mage::registry("ajaxcompare_check_code");
         if (count($_check_code) && in_array($_block_code, $_check_code)) {
             $transport = $observer->getTransport();
             $html = $transport->getHtml();
             $_code = str_replace(".", '-', $_block_code);
             $transport->setHtml('<div id="ajaxcompare-reload-block-' . $_code . '">' . $html . "</div>");
         }
     }
     return;
 }
开发者ID:igorvasiliev4,项目名称:magento_code,代码行数:29,代码来源:Observer.php

示例2: addSortableScriptOnGrid

 /**
  * Appends the "sortable" js code to the bottom of ajax-Request for the category-products loaded after
  * changing sort order.
  *
  * @param Varien_Event_Observer $observer
  */
 public function addSortableScriptOnGrid(Varien_Event_Observer $observer)
 {
     $_block = $observer->getBlock();
     $_type = $_block->getType();
     if (Mage::helper('ffuenf_categoryproductsortbackend')->isExtensionActive() && $_type == 'adminhtml/catalog_category_tab_product') {
         $content = $observer->getTransport()->getHtml();
         $dom = new DOMDocument('1.0', 'utf-8');
         $doc = new DOMDocument('1.0', 'utf-8');
         $dom->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'));
         foreach ($dom->getElementsByTagName('select') as $element) {
             if ($element->getAttribute('name') == 'limit') {
                 $option = $dom->createElement('option');
                 $option->appendChild($dom->createTextNode('All'));
                 $option->setAttribute('value', 0);
                 $option = $element->appendChild($option);
             }
         }
         $additionalHtml = $this->appendScript($content);
         $additionalDoc = new DOMDocument();
         $additionalDoc->loadHTML($additionalHtml);
         $additionalDocScript = $additionalDoc->getElementsByTagName('script')->item(0);
         $body = $dom->getElementsByTagName('body')->item(0);
         foreach ($body->childNodes as $child) {
             $doc->appendChild($doc->importNode($child, true));
         }
         $doc->appendChild($doc->importNode($additionalDocScript, true));
         $content = $doc->saveHTML();
         $observer->getTransport()->setHtml($content);
     }
 }
开发者ID:WestAgency,项目名称:Ffuenf_CategoryProductSortBackend,代码行数:36,代码来源:Observer.php

示例3: onCoreBlockToHtmlAfter

 public function onCoreBlockToHtmlAfter(Varien_Event_Observer $observer)
 {
     $helper = $this->helper();
     if ($helper->isCacheable() && !$this->_cached) {
         /* @var $block Mage_Core_Block_Abstract */
         $block = $observer->getEvent()->getBlock();
         $blockName = $block->getNameInLayout();
         if ($blockName == 'global_messages') {
             $block->setTemplate('bubble/fpc/messages.phtml');
             $observer->getTransport()->setHtml($block->renderView());
         } elseif ($helper->isBlockDynamic($blockName)) {
             // Save block html in cache
             $html = $observer->getTransport()->getHtml();
             $html = $helper->cleanHtml($html);
             $dynamicBlock = $helper->getBlockInstance($blockName);
             $helper->saveBlock($dynamicBlock->getName(), $html);
             if ($helper->isActionCacheable()) {
                 $placeholder = $dynamicBlock->getPlaceholder();
                 $hash = md5($placeholder);
                 $this->_placeholders[$hash] = $placeholder;
                 $html = sprintf($this->_placeholderFormat, $hash, $html, $hash);
                 $observer->getTransport()->setHtml($html);
             }
         }
     }
 }
开发者ID:technomagegithub,项目名称:inmed-magento,代码行数:26,代码来源:Observer.php

示例4: coreBlockAbstractToHtmlAfter

 public function coreBlockAbstractToHtmlAfter(Varien_Event_Observer $observer)
 {
     if (!Mage::helper('aw_giftcard')->isModuleOutputEnabled()) {
         return $this;
     }
     if ($observer->getBlock() instanceof Mage_Checkout_Block_Cart_Coupon) {
         $block = Mage::app()->getLayout()->createBlock('aw_giftcard/frontend_checkout_cart_giftcard');
         $observer->getTransport()->setHtml($observer->getTransport()->getHtml() . $block->toHtml());
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:extensiongsd,代码行数:11,代码来源:Totals.php

示例5: insertBlock

 public function insertBlock(Varien_Event_Observer $observer)
 {
     if (Mage::app()->getFrontController()->getAction()->getFullActionName() === 'adminhtml_dashboard_index') {
         if ($observer->getBlock()->getUseAsDashboardHook()) {
             $html = $observer->getTransport()->getHtml();
             $zendeskDash = $observer->getBlock()->getLayout()->createBlock('zendesk/adminhtml_dashboard')->setName('zendesk_dashboard');
             $zendeskGrid = $zendeskDash->getLayout()->createBlock('zendesk/adminhtml_dashboard_grids')->setName('zendesk_dashboard_grids');
             $zendeskDash->setChild('zendesk_dashboard_grids', $zendeskGrid);
             $html .= $zendeskDash->toHtml();
             $observer->getTransport()->setHtml($html);
         }
     }
 }
开发者ID:drunkvegas,项目名称:done,代码行数:13,代码来源:Observer.php

示例6: afterAbstractHtml

 /**
  * Adds DDQ HTML to inventory tab (where editing products). Could potentially also
  * be used for other things in the future.
  *
  * @param Varien_Event_Observer $observer
  */
 public function afterAbstractHtml(Varien_Event_Observer $observer)
 {
     try {
         /* @var $block Mage_Core_Block_Abstract */
         $block = $observer->getEvent()->getBlock();
         $blockClass = get_class($block);
         if ($this->_getControllerName() == 'catalog_product' && ($this->_getActionName() == 'edit' || $this->_getActionName() == 'new')) {
             if ($blockClass == 'Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Inventory' || $blockClass == 'Aitoc_Aitpermissions_Block_Rewrite_AdminhtmlCatalogProductEditTabInventory') {
                 // adds our customised block to the inventory tab
                 $observer->getTransport()->setHtml($observer->getTransport()->getHtml() . Mage::getBlockSingleton('ddq/adminhtml_catalog_product_form')->toHtml());
             }
         }
     } catch (Exception $e) {
         Mage::helper('ddq')->log($e->getMessage());
     }
 }
开发者ID:finelinePG,项目名称:finelink-dev,代码行数:22,代码来源:Adminhtml.php

示例7: handleInlineJs

 /**
  * @param Varien_Event_Observer $observer
  *
  * @return $this
  */
 public function handleInlineJs(Varien_Event_Observer $observer)
 {
     Varien_Profiler::start('MeanbeeFooterJs');
     /** @var Meanbee_Footerjs_Helper_Data $helper */
     $helper = Mage::helper('meanbee_footerjs');
     if (!$helper->isEnabled()) {
         return $this;
     }
     /** @var Mage_Core_Block_Abstract $block */
     $block = $observer->getBlock();
     if (!is_null($block->getParentBlock())) {
         // Only look for JS at the root block
         return $this;
     }
     /** @var Varien_Object $transport */
     $transport = $observer->getTransport();
     $patterns = array('js' => self::REGEX_JS, 'document_end' => self::REGEX_DOCUMENT_END);
     foreach ($patterns as $pattern) {
         $matches = array();
         $html = $transport->getHtml();
         $success = preg_match_all($pattern, $html, $matches);
         if ($success) {
             $text = implode('', $matches[0]);
             $html = preg_replace($pattern, '', $html);
             $transport->setHtml($html . $text);
         }
     }
     Varien_Profiler::stop('MeanbeeFooterJs');
     return $this;
 }
开发者ID:roman204,项目名称:magento-footer-js,代码行数:35,代码来源:Observer.php

示例8: blogRouteGetObserver

 /**
  * Retrieve the blog route
  * If Root enabled, set the blog route as an empty string
  *
  * @param Varien_Event_Observer $observer
  * @return $this
  */
 public function blogRouteGetObserver(Varien_Event_Observer $observer)
 {
     if ($this->isEnabled()) {
         $observer->getTransport()->setBlogRoute('');
     }
     return $this;
 }
开发者ID:technomagegithub,项目名称:inmed-magento,代码行数:14,代码来源:Data.php

示例9: interceptOutput

 public function interceptOutput(Varien_Event_Observer $observer)
 {
     $transport = $observer->getTransport();
     $html = $transport->getHtml();
     if (strpos($html, '<div class="middle"') !== false && isset($_GET['cleantalk_message'])) {
         $html = str_replace('<div class="middle"', '<div class="notification-global  notification-global-error"><b>CleanTalk error: ' . $_GET['cleantalk_message'] . '</b></div><div class="middle"', $html);
         $transport->setHtml($html);
     }
     $show_notice = intval(Mage::getStoreConfig('general/cleantalk/show_notice'));
     if (strpos($html, '<div class="middle"') !== false && $show_notice == 1) {
         $message = "Like Anti-spam by CleanTalk? Help others learn about CleanTalk! <a  target='_blank' href='http://www.magentocommerce.com/magento-connect/antispam-by-cleantalk.html'>Leave a review at the Magento Connect</a> <a href='?close_notice=1' style='float:right;'>Close</a>";
         $html = str_replace('<div class="middle"', '<div class="notification-global  notification-global-notice">' . $message . '</div><div class="middle"', $html);
         $transport->setHtml($html);
     }
     if (strpos($html, '%LINK_TEXT%') !== false) {
         $api_key = Mage::getStoreConfig('general/cleantalk/api_key');
         if (trim($api_key) == '') {
             Mage::app()->cleanCache();
             $admin_email = Mage::getStoreConfig('trans_email/ident_general/email');
             $button = "<input type='button' style='margin-top:5px;-webkit-border-bottom-left-radius: 5px;-webkit-border-bottom-right-radius: 5px;-webkit-border-radius: 5px;-webkit-border-top-left-radius: 5px;-webkit-border-top-right-radius: 5px;background: #3399FF;border-radius: 5px;box-sizing: border-box;color: #FFFFFF;font: normal normal 400 14px/16.2px \"Open Sans\";padding:3px;border:0px none;cursor:pointer;' value='Get access key automatically' onclick='location.href=\"?get_auto_key=1\"'><br /><a target='_blank' href='https://cleantalk.org/register?platform=magento&email=" . $admin_email . "&website=" . $_SERVER['HTTP_HOST'] . "'>Click here to get access key manually</a><br />Admin e-mail (" . $admin_email . ") will be used for registration<br /><a target='__blank' href='http://cleantalk.org/publicoffer' style='color:#e5e5e5'>License agreement</a>";
             $html = str_replace('%LINK_TEXT%', $button, $html);
         } else {
             $html = str_replace('%LINK_TEXT%', "<a target='__blank' href='http://cleantalk.org/my' >Click here to get anti-spam statistics</a>", $html);
         }
         $transport->setHtml($html);
     }
 }
开发者ID:CleanTalk,项目名称:magento-antispam,代码行数:27,代码来源:Observer.php

示例10: coreBlockAbstractToHtmlAfter

 /**
  * Looks for the hook we set and adds our own custom block.
  *
  * @param Varien_Event_Observer $observer
  * @return Smartbear_Alertsite_Model_Observer
  */
 public function coreBlockAbstractToHtmlAfter(Varien_Event_Observer $observer)
 {
     if (!Mage::helper('alertsite')->getConfig('alertsite_config', 'enabled') || strlen(trim(Mage::helper('alertsite')->getConfig('alertsite_config', 'alertsite_user'))) < 1) {
         return $this;
     }
     if (Mage::app()->getFrontController()->getAction()->getFullActionName() === 'adminhtml_dashboard_index') {
         if ($observer->getBlock()->getAlertsiteDashboardHook()) {
             $html = $observer->getTransport()->getHtml();
             // grab the html that's already rendered
             /** @var $dashboardBox Smartbear_Alertsite_Block_Adminhtml_Dashboard */
             $dashboardBox = $observer->getBlock()->getLayout()->createBlock('alertsite/adminhtml_dashboard');
             $dashboardBox->insert($observer->getBlock()->getLayout()->createBlock('core/template', 'alertsite.subheader')->setTemplate('alertsite/subheader.phtml'));
             $html .= $dashboardBox->toHtml();
             $observer->getTransport()->setHtml($html);
         }
     }
     return $this;
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:24,代码来源:Observer.php

示例11: setRowUrl

 /**
  * Sets the row url in the transport object for a cms_page model
  *
  * @param Varien_Event_Observer $observer Observer Instance
  */
 public function setRowUrl(Varien_Event_Observer $observer)
 {
     /* @var $history FireGento_AdminMonitoring_Model_History */
     $history = $observer->getHistory();
     $rowUrl = $this->_getRowUrl($history, $this->_getClassName(), $this->_getRoutePath(), $this->_getRouteParams($history->getOriginalModel()));
     if ($rowUrl) {
         $observer->getTransport()->setRowUrl($rowUrl);
     }
 }
开发者ID:giuseppemorelli,项目名称:firegento-adminmonitoring,代码行数:14,代码来源:Abstract.php

示例12: handleRedirect

 /**
  * @event controller_response_redirect
  * @param Varien_Event_Observer $event
  */
 public function handleRedirect(Varien_Event_Observer $event)
 {
     $core = $this->_getCore();
     if ($core->isHoAjax() && !$core->isProceed()) {
         $core->setProceed();
         $response = Mage::getModel('ho_bootstrapajaxcart/response');
         $response->handleRedirect($this->_prepareRedirectUrl($event->getTransport()->getUrl()));
         $response->sendResponse();
     }
 }
开发者ID:hsq,项目名称:Ho_Ajax,代码行数:14,代码来源:Observer.php

示例13: onCoreBlockAbstractToHtmlAfter

 public function onCoreBlockAbstractToHtmlAfter(Varien_Event_Observer $observer)
 {
     $block = $observer->getBlock();
     if ($block instanceof Mage_Catalog_Block_Product_Price) {
         $id = $block->getProduct()->getId();
         if (!Mage::registry('amlabel_product_id_' . $id)) {
             // add product ID info in output
             Mage::register('amlabel_product_id_' . $id, true);
             $html = $html = $observer->getTransport()->getHtml();
             $observer->getTransport()->setHtml('<div class="price" id="amlabel-product-price-' . $id . '" style="display:none"></div>' . $html);
             // add label for product
             $label = Mage::helper('amlabel')->getLabels($block->getProduct());
             if ($label) {
                 $this->addScript($id, addslashes($label));
             }
         }
     }
     return $this;
 }
开发者ID:hientruong90,项目名称:ce_magento,代码行数:19,代码来源:Observer.php

示例14: addTemplateHints

 /**
  * Add Template Hints
  *
  * @param Varien_Event_Observer $observer
  *
  */
 public function addTemplateHints(Varien_Event_Observer $observer)
 {
     if (!$this->showHints()) {
         return;
     }
     if (substr(trim($observer->getTransport()->getHtml()), 0, 4) == 'http') {
         return;
     }
     $block = $observer->getBlock();
     /* @var $block Mage_Core_Block_Abstract */
     if (!$block || !$block instanceof Mage_Core_Block_Abstract) {
         return;
     }
     $transport = $observer->getTransport();
     $blockHtml = $transport->getHtml();
     $this->hintId++;
     $wrappedHtml = '<div id="thh-' . $this->hintId . '-start" class="thh-wrap thh-start"></div>';
     $wrappedHtml .= $blockHtml;
     $wrappedHtml .= '<div id="thh-' . $this->hintId . '-stop" class="thh-wrap thh-stop"></div>';
     $transport->setHtml($wrappedHtml);
 }
开发者ID:claudiu-marginean,项目名称:mage-template-hints-hover,代码行数:27,代码来源:Observer.php

示例15: addPagarmeJs

 public function addPagarmeJs(Varien_Event_Observer $observer)
 {
     $block = $observer->getEvent()->getBlock();
     $blockType = $block->getType();
     $targetBlocks = array('checkout/onepage_payment', 'aw_onestepcheckout/onestep_form_paymentmethod', 'onestepcheckout/onestep_form_paymentmethod');
     if (in_array($blockType, $targetBlocks) && Mage::getStoreConfig('payment/pagarme_cc/active')) {
         $transport = $observer->getTransport();
         $html = $transport->getHtml();
         $preHtml = $block->getLayout()->createBlock('core/template')->setTemplate('pagarme/checkout/payment/js.phtml')->toHtml();
         $transport->setHtml($preHtml . $html);
     }
 }
开发者ID:hiuryanderson,项目名称:pagarme-magento,代码行数:12,代码来源:Observer.php


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