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


PHP Varien_Event_Observer::getPage方法代码示例

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


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

示例1: addPageTag

 /**
  * Add CMS page tag on all CMS pages except homepage
  *
  * @param Varien_Event_Observer $observer
  */
 public function addPageTag(Varien_Event_Observer $observer)
 {
     $pageId = $observer->getPage()->getIdentifier();
     $homePageId = Mage::getStoreConfig('web/default/cms_home_page');
     if ($pageId != $homePageId) {
         $observer->getControllerAction()->getLayout()->getUpdate()->addHandle('mbiz_trackingtags_page');
     }
 }
开发者ID:alexis-hermanns,项目名称:Mbiz_TrackingTags,代码行数:13,代码来源:Observer.php

示例2: trackFiles

 /**
  * @param Varien_Event_Observer $event
  */
 public function trackFiles($event)
 {
     $page = $event->getPage();
     $storeId = $event->getStoreId();
     $pageId = $page->getId();
     $pageContent = $page->getContent();
     $links = array();
     $allowedFileTypes = $this->getAllowedFileTypesRegex();
     preg_match_all('/<a href=\\"\\/([^\\"]*)\\.' . $allowedFileTypes . '\\".*>.*<\\/a>/iU', $pageContent, $links);
     if (empty($links[0])) {
         // bail out if we didn't find any file links, save a couple CPU cycles
         return;
     }
     $foundFiles = array();
     $trackedFiles = $this->getTrackedFilesForPage($pageId);
     $numberOfFiles = count($links[0]);
     for ($i = 0; $i < $numberOfFiles; $i++) {
         $foundFiles[] = '/' . htmlspecialchars_decode($links[1][$i]) . '.' . $links[2][$i];
     }
     $addedFiles = array_diff($foundFiles, $trackedFiles);
     $removedFiles = array_diff($trackedFiles, $foundFiles);
     $this->addFilesToTracking($storeId, $pageId, $addedFiles);
     $this->removeFilesFromTracking($storeId, $pageId, $removedFiles);
 }
开发者ID:VadzimBelski-ScienceSoft,项目名称:magento-MagSolr,代码行数:27,代码来源:Page.php

示例3: cmsPageRender

 /**
  * add CMSPAGE_{ID} handle to layout on cms page render
  *
  * @param Varien_Event_Observer $observer
  * @return Varien_Event_Observer
  */
 public function cmsPageRender(Varien_Event_Observer $observer)
 {
     $observer->getControllerAction()->getLayout()->getUpdate()->addHandle('CMSPAGE_' . $observer->getPage()->getId());
 }
开发者ID:OurLaborisJoy,项目名称:FireGento_FlexCms,代码行数:10,代码来源:Observer.php

示例4: addBarcode

 /**
  * Adds a barcode representing the order number to the shipment if activated.
  *
  * @param  Varien_Event_Observer $observer observer which is passed by magento
  *
  * @return FireGento_Pdf_Model_Observer
  */
 public function addBarcode(Varien_Event_Observer $observer)
 {
     if (!Mage::getStoreConfigFlag('sales_pdf/shipment/order_id_as_barcode')) {
         return $this;
     }
     $page = $observer->getPage();
     $order = $observer->getOrder();
     $barcodeConfig = array('drawText' => false, 'orientation' => 90, 'text' => $order->getIncrementId());
     $rendererConfig = array('verticalPosition' => 'middle', 'moduleSize' => 0.9);
     // create dummy Zend_Pdf object, which just stores the current page, so that we can pass it in
     // Zend_Barcode_Renderer_Pdf->setResource()
     $pdf = new Zend_Pdf();
     $pdf->pages[] = $page;
     /** @var $renderer Zend_Barcode_Renderer_Pdf */
     $renderer = Zend_Barcode::factory('code128', 'pdf', $barcodeConfig, $rendererConfig)->setResource($pdf, 0);
     // calculate left offset so that barcode is printed on the right with a little margin
     $leftOffset = $page->getWidth() - $renderer->getBarcode()->getWidth(true) * $renderer->getModuleSize() - 10;
     $renderer->setLeftOffset($leftOffset);
     $renderer->draw();
     return $this;
 }
开发者ID:codedge,项目名称:firegento-pdf,代码行数:28,代码来源:Observer.php


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